tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Reilly <m.rei...@its.uq.edu.au>
Subject How do you get Tomcat 4.x to use the same classloader for a web-app's servlets and JSP's?
Date Fri, 16 Jan 2004 01:49:50 GMT
How do you get Tomcat 4.x to use the same classloader for a web-app's servlets 
and JSP's?

I have a class that initialises logging, constants, database settings, 
resource bundles, property files etc.

I setup the web.xml to load the servlet on startup, which setups the class 
correctly.

I was recieving some funny messages about missing resource bundles in the JSP 
while it looked fine in servlet.

I put some Log4j logging into the static init method of the constant class.

Then, I loaded the servlet, which worked. After giving it about 10 or so 
seconds, I loaded the JSP, which failed.

When I checked the logs, I saw quickly what was happening. The servlet was 
being loaded twice. Upon checking the class loader faq and other 
documentation, I found a note that says JSP's are loaded in a different 
classloader!!

2004-01-16 11:34:18,419 [utils.Constants] [INFO ] [] ******************* 
Servlet initialisation starting
2004-01-16 11:34:18,419 [utils.Constants] [INFO ] [] Loading Constants
2004-01-16 11:34:29,252 [utils.Constants] [INFO ] [] ******************* 
Servlet initialisation starting
2004-01-16 11:34:29,268 [utils.Constants] [INFO ] [] Loading Constants

Something to do with PropertiesResourceBundles seems to stop them being loaded 
successfully by two different class-loaders.

Does anyone have any suggestions on a) how to fix this glaring problem, or b) 
obtain a reference to the JSP class loader so I can load config and properties 
resource bundles through it?


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message