Re: help with embedded tomcat's webapp classloader
Donald Ball wrote: everything works okay but my webapp fails on initialization, with a NoClassDefFoundError on net.sf.hibernate.HibernateException. this is somewhat surprising given that hibernate.jar lives in the webapp's WEB-INF/lib directory. is there some additional configuration i need to do on my embedded Context object to force it to act like a normal tomcat webapp Context? do i perhaps need to ensure the webapp directory structure is in place before constructing my Tomcat instance? (that is to say, are the contents of WEB-INF/lib examined when the Context is created and/or added to the Host, or when tomcat is started?) i worked around this issue by simply adding the classpath resources under WEB-INF to the classpath of the swt application in which tomcat is embedded. not a very elegant solution, but it'll do for the moment. now i find that jsp files cannot be compiled because Jasper is unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. ought i hunt down tools.jar and add that to my classpath manually as well, or can someone point me towards some documentation w.r.t. configuring embedded tomcat's webapp classloaders? i'm frankly unable to tell if this behavior is expected and i'm supposed to be manually doing some extra initialiation work on my Context, or if this is unusual behavior and i'm doing something wrong? any suggestions? - donald - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
help with embedded tomcat's webapp classloader
hey guys. i'm trying out embedding tomcat 5.0 in an swt app that creates complex configuration data for a webapp. basically, i'd like the users to be able to do a test deploy of the webapp on their own box using hsqldb and an embedded tomcat. my code looks more or less like so: import org.apache.catalina.*; import org.apache.catalina.logger.FileLogger; import org.apache.catalina.realm.MemoryRealm; import org.apache.catalina.startup.Embedded; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.net.InetAddress; public final class Tomcat { private static final Log log = LogFactory.getLog(Tomcat.class); private final Embedded embeddedTomcat; private final Engine baseEngine; private final Host baseHost; private final Context rootContext; public Tomcat() { embeddedTomcat = new Embedded(); final FileLogger fileLogger = new FileLogger(); fileLogger.setDirectory("."); fileLogger.setPrefix("myTomcat"); fileLogger.setSuffix(".log"); fileLogger.setTimestamp(true); embeddedTomcat.setLogger(fileLogger); final MemoryRealm memoryRealm = new MemoryRealm(); embeddedTomcat.setRealm(memoryRealm); baseEngine = embeddedTomcat.createEngine(); baseEngine.setName("myEngine"); baseEngine.setDefaultHost("localhost"); baseHost = embeddedTomcat.createHost("localhost", "webapps"); baseEngine.addChild(baseHost); rootContext = embeddedTomcat.createContext("", "ROOT"); baseHost.addChild(rootContext); embeddedTomcat.addEngine(baseEngine); final Connector httpConnector = embeddedTomcat.createConnector((InetAddress)null, 8080, false); embeddedTomcat.addConnector(httpConnector); } public void start() { try { embeddedTomcat.start(); } catch (LifecycleException e) { log.error("Error starting tomcat", e); } } public void stop() { try { embeddedTomcat.stop(); } catch (LifecycleException e) { log.error("Error stopping tomcat", e); } } } everything works okay but my webapp fails on initialization, with a NoClassDefFoundError on net.sf.hibernate.HibernateException. this is somewhat surprising given that hibernate.jar lives in the webapp's WEB-INF/lib directory. is there some additional configuration i need to do on my embedded Context object to force it to act like a normal tomcat webapp Context? do i perhaps need to ensure the webapp directory structure is in place before constructing my Tomcat instance? (that is to say, are the contents of WEB-INF/lib examined when the Context is created and/or added to the Host, or when tomcat is started?) - donald - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
question on mapping urls to tomcat using mod_jk2
hi guys. i'm using mod_jk2 to connect apache httpd 1.3 to tomcat 4.1.28. everything is working great, much smoother than mod_webapp. i'm only having one issue so far. apache is serving requests via both http and https. my webapp is mounted at /example. I would like to allow https requests through, but redirect http requests to https. I would have imagined that I could use the apache Redirect directive to accomplish this, but apparantly mod_jk2 is intercepting the request before the standard apache handlers get a chance to deal with it. I'm pretty sure that when I upgrade to apache2, I can accomplish this by doing the jk mapping inside httpd.conf inside VirtualHost sections using JkUriSet directives, but this does not appear to be an option for apache-1.3. It would seem that you cannot explicitly limit the url mapping in workers2.properties to http or https only. Is my assessment correct? Does anyone have a suggested workaround? One would imagine this is not an uncommon situation. The only effective solution I can think of is to have separate apache-1.3 instance for http and https, but that's undesirable for several reasons. - donald - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Web Page Caching
On 3/3/2003 at 9:44 AM Filip Hanik wrote: >hi Donald, >if you are talking about a JSP, that is not a file, it is a Java class. >Hence once it is loaded into memory, it will stay there. But it is not >cached perse if you'd read remy's response to my bug report, you'll see that he clearly indicates there is (small) server-side cache: "I can reproduce it. It doesn't happen with non-JSPs, such as images, so it shouldn't be a cache bug. BTW, the (small) delay is there because there's a cache." - donald - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Web Page Caching
On 3/3/2003 at 9:10 AM Filip Hanik wrote: >nope, no caching in Tomcat. The browser however, may cache your pages :) i'm almost positive that's not true, tomcat does employ at least a limited cache of jsp page output. see the responses to my bug: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16113 - donald - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Two Realms for client authentication
On 2/28/2003 at 5:25 PM Gil wrote: >Can I use two Realms for client authentication?? I would like to define a >set of servlets that uses a Realm and another set of sevlets that uses >another Realm. Can I make this?? In the same webapp? I don't think so. I think you have a few choices: 1. split the servlets into two webapps, each which its own Realm. annoying and pedantic. 2. Write your own Realm which acts as a front-end to the two real Realms and dispatches authentication requests to one or the other based on some criteria... don't know if Realms get enough information to make this decision though. 3. you might check out the securityfilter project: http://securityfilter.sourceforge.net/ they're trying to mitigate some of the portability problems associated with CMS by bundling the security into the webapps themselves. interesting approach, might work for you. - donald - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HTTP Status 500 Error
On 2/27/2003 at 1:30 PM Raible, Matt wrote: >web.xml - an example: > > >500 >/error.jsp?code=500 > note - be sure when you do this to manually set the status code. e.g. in this jsp page you would do: <% response.setStatus(Integer.parseInt(request.getParameter("code"))); %> otherwise the http user agent will get a response code of 200 instead of a 500. - donald - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSPs sometimes don't recompile
On 2/27/2003 at 2:21 PM Mark G.K. Christenson wrote: >I'm assuming it doesn't continue to work if you remove the file and >then restart tomcat. If you remove it after it's been compiled and >don't restart tomcat, it will continue to work because once the class >has been compiled and loaded, it doesn't need the class file from the >filesystem. > >All of this works much more sanely in v4+. > >Any reason you can't migrate to 4.1.x? friendly warning (with a small ulterior motive) - there are some not entirely dissimilar problems with jsp files in 4.1. it turns out that if you remove a jsp, then someone hits its url triggering a 404, then you replace the jsp, the 404 is permanently cached inside tomcat and you are forced to restart the webapp or tomcat to cause tomcat to recognize the new jsp page. vote for this bug if this behavior bothers you: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16113 - donald - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: realm getRole() method ?
>> There is no such facility in the servlet api. Given a user, there is no >way >> to get a list of roles to which the user belongs. I too find this a >> distressing limitation in using container managed security. > >In some complex security scenarios, it is not always possible for a >container to articulate all possible roles that a user can be a member of. I guess, but I don't really actually care about that functionality. I can't see why it's not desirable to be able to get a list of roles that a user _does_ belong to. >Tomcat doesn't enforce this restriction, but the J2EE specs say that an >app must list all the roles it uses (either in security constraints or >via programmatic lookups) in elements in the web.xml file. >If you did this, you could parse "/WEB-INF/web.xml" and identify the list. That's an interesting feature/restriction. I guess while I have your attention :) I'd ask how/if you'd solve this problem using container-managed security? You've got a webapp which, I dunno, implements a document management system. The DMS puts documents into several categories, and various users can add, edit, or remove documents in those categories, depending on their roles in those categories. Assuming the categories are dynamic, there's no way to implement this using container-managed security, is there? - donald - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: realm getRole() method ?
On 2/27/2003 at 5:07 PM laurent marot wrote: >thanks but this method just allows checking if user match a role, i'd like >to get a method to discover the role. There is no such facility in the servlet api. Given a user, there is no way to get a list of roles to which the user belongs. I too find this a distressing limitation in using container managed security. Best you can do is iterate over the list of role names and see which ones to which the user belongs, which of course doesn't help you if you don't have such a list. - donald - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
precompiling jsp pages
Hi guys. I'm trying to precompile my jsp pages into servlets like the tomcat developers recommend so that I don't have to worry about memory leaks and whatnot on the production servlet container. Unfortunately, jasper's JspC is giving me fits. One version generates servlets that have race conditions that can result in apparent server deadlock. Another version can't deal with my directory structure (e.g. /foo.jsp and /foo/bar.jsp) and/or the fact that I use taglibs. None of the versions seem to work with the ant jspc task. Argh! Does anyone have a particular combination that works for them? The target servlet container is tomcat-4.0.6, although it really shouldn't matter as long as I stick jasper-runtime.jar in my WEB-INF/lib, right? - donald - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
configuration help with mod_jk and tomcat-4.0b5
heya. i'm having trouble getting mod_jk working with tomcat-4.0b5. i have apache talking to tomcat-4.0b5 successfully, but i always get this error when requesting a url that should pass through to tomcat: HTTP Status 503 - This application is not currently available the logger for the service reveals: 2001-06-29 14:25:00 StandardHost[foobar.webslingerz.com]: Installing web application at context path /intranet from URL file:/usr/local/jakarta-tomcat-4.0-b5/webapps/intranet 2001-06-29 14:25:00 StandardManager[/intranet]: Seeding random number generator class java.security.SecureRandom 2001-06-29 14:25:00 StandardManager[/intranet]: Seeding of random number generator has been completed 2001-06-29 14:25:01 ContextConfig[/intranet]: Added certificates -> request attribute Valve 2001-06-29 14:25:01 StandardContext[/intranet]: Error initializing naming context for context /intranet 2001-06-29 14:25:01 StandardContext[/intranet]: Context startup failed due to previous errors my server.xml contains this service descriptor: and the 'intranet' webapp is unpacked underneath my webapps directory. it works fine with i use the http server built into tomcat-4.0b5. does anyone have a suggestion? is this, in fact, more appropriately discussed on the tomcat-dev list (since it's about catalina)? - donald
RE: format of uriworkermap.properties file?
On Wed, 30 May 2001, Ignacio J. Ortega wrote: > AFAIK, you need to declare a "foo" context too.. because if you does not > have a "foo" context the redirection should work but Tomcat does not > find "/foo/b.xml" at all.. actually, the only context that tomcat is serving is the ROOT context. my .xml files live all over the web tree. - donald
format of uriworkermap.properties file?
heya. i've got iis and tomcat-3.2.1 talking to each other, hurrah! now what i'd like to do is have iis pass all requests for a uri with a given extension, say .xml, on to tomcat, but i can't tell how to write that in uriworkermap.properties. my first guess would be: /*.xml=ajp12 but it doesn't seem to be work everywhere. /foo.xml is passed through to tomcat but /foo/bar.xml is not. is this the expected behavior? what should i put in my uriworkermap.properties file instead? is the format of that file actually documented anywhere? the tomcat+iis instruction page, while very helpful in getting things working, isn't terribly good as a reference. - donald
question regarding realms
hi guys. i'm running tomcat-catalina out of cvs and i'm trying to protect my standalone tomcat-catalina instance using the same crypted passwords that live in my existing apache.htpasswd files - either using MemoryRealm or JDBCRealm, i don't care much which. i'd imagine this is fairly common, does anyone have a working configuration they could share? i note the JDBCRealm stuff has been refactored since b3, and now you can apparantly request a particular digest, but it's unclear how to go about doing so, and what the proper value would be for a 'crypt' digest. any help? tia. - donald
suggestions for tomcat
hey. i just went about installing tomcat-3.2.1 + apache-1.3.19 on a server for the first time - until now i've been relying on jserv and catalina in standalone mode. here are a few suggestions to make life easier for tomcat users: 1. the binary linux mod_jk.so on the web site doesn't work with blackdown jvm-1.3 and apache-1.3.19. you might document which jvm and apache version it is known to work with (along with whatever other variables are relevant - glibc maybe). you might also provide some precompiled dso's for other common jvm/apache combinations. 2. or you might just include the mod_jk source along with the binary distribution. 3. you might document explicitly in large bold letters that jakarta should not be run as root unless it's listening on a privileged port. 4. you might also document which directories and/or files in the tomcat distribution tree should be writable and/or owned by the user tomcat runs as and which should _not_ be writable by the tomcat user. i bet most people just chown -R tomcat.tomcat the distribution tree, but that's not a good strategy. you might also provide a script to chown the files properly. just my thoughts as a first-time installer. oh, and as far as catalina goes, i would have like to have helped beta test mod_webapp, but i couldn't find any documentation on how to configure it in apache. - donald