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 04:10:43 GMT
use

ResourceBundle.getBundle(String baseName,
                         Locale locale,
                         ClassLoader loader)


that should take care of your problem with different classloaders
as a classloader, if you are unsure, just pass in
MyUtilClass.class.getClassLoader() where my util class sits under
web-inf/classes or lib


Filip

-----Original Message-----
From: news [mailto:news@sea.gmane.org]On Behalf Of Michael Reilly
Sent: Thursday, January 15, 2004 8:05 PM
To: tomcat-user@jakarta.apache.org
Subject: Re: How do you get Tomcat 4.x to use the same classloader for a
web-app's servlets and JSP's?


Filip,

> 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

I have some properties files located under web-inf/classes.

the ant script I am using puts them in there, along with class files.

So when I use

ResourceBundle msg = ResourceBundler.getBundle("util.Messages.properties"),

it uses the class loader to obtain the actual resource.

So, if they are different class loaders, you can't use that mechanism.

Even so, I don't want Tomcat to be running the servlet init method
twice like
it currently does.

That just seems like a waste of resources.

When I add <load-on-startup>1</load-on-startup> to web.xml, it runs
it twice.

That is the behaviour I also want to stop.



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