tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Garret Wilson <gar...@globalmentor.com>
Subject Re: missing resource bundle shouldn't be
Date Mon, 06 Sep 2004 21:55:13 GMT
QM wrote:
> : Then what's the solution? I've tried moving the jar from common/lib to 
> : WEB-INF/lib, but that didn't help. Unjarring the files into 
> : WEB-INF/classes didn't work, either.
> 
> When you say "the jar," you mean "the jar containing my servlet
> classes," correct?

Right.

 > That should work.  You restarted Tomcat after this
> change, right?

And restarted and shutdown and started and restarted... :)

> You could also clear the work/ dir to be certain.

I'll try that---it wouldn't cache a jar, would it?

> -and if I may ask, why'd you put the servlet classes in common/lib?

I was planning on using the same set of libraries for multiple web 
apps---the jar in question had more than just servlets for a single web app.

But, to take this issue out of the equation, I've tried putting the jar 
in WEB-INF/lib (where I assume you would say it should go) to no avail.

> : How can I programmatically reference the appropriate classloader from 
> : within my servlet so that I can access property files in 
> : WEB-INF/classes?
> 
> You don't. =) That would, in some sense, defeat the purpose of having
> each webapp live in its own classloader.

Now this doesn't make sense to me. Let's say I have the following JSP:

/index.jsp

This index.jsp file can load resources just fine from WEB-INF/classes.

Now let's say I delete index.jsp and create a class called IndexServlet, 
and map it to /index . From that servlet, I attempt to load a resource 
bundle from WEB-INF/classes---it doesn't work!

But in the first instance the web container takes index.jsp and creates 
its own servlet---*that* is what really gets called from the container. 
If I look in work/ and find the servlet behind index.jsp, I see the same 
code to load a resource bundle from WEB-INF/classes, which works.

So let me restate my question: how can I allow my servlets to load the 
same resource bundle (from the same location) that my JSP can load? 
Because, after all, behind the scenes a JSP *is* a servlet!

Surely the web container doesn't use a different classloader for 
container-generated servlets and user-created servlets in the same 
context---does it? (And if it does, where should I put my resource 
bundles so that the user-created servlets can access them?)

Garret

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