tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Filip Hanik" <devli...@hanik.com>
Subject Re: 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 02:16:35 GMT
you can pre compile your JSPs into servlets, the drawback is that you can't
reload JSPs

but why do you need the JSPs and servlets class loader to be the same,
just use a shared util class (web-inf/classes or lib), load the resource
bundles through that one
one level down, that way the classloader is the same
Filip

----- Original Message -----
From: "Michael Reilly" <m.reilly@its.uq.edu.au>
To: <tomcat-user@jakarta.apache.org>
Sent: Thursday, January 15, 2004 5:49 PM
Subject: How do you get Tomcat 4.x to use the same classloader for a
web-app's servlets and JSP's?


> 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


---------------------------------------------------------------------
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