George,
George Sexton wrote:
Different class loader. The JSP's are running in a class-loader with the application, while the common/lib jars are in a different class-loader where the WEB-INF/classes are not part of the search path.
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.
How can I programmatically reference the appropriate classloader from within my servlet so that I can access property files in WEB-INF/classes? Or should I put my resource bundles somewhere else? It seems a shame that my JSP files can access the resource bundles, but my servlets can't---when the JSP files get compiled into servlets, anyway.
Garret
-----Original Message-----
From: Garret Wilson [mailto:[EMAIL PROTECTED] Sent: Monday, September 06, 2004 11:40 AM
To: [EMAIL PROTECTED]
Subject: Re: missing resource bundle shouldn't be
Oh, and I'm using JDK 1.5 RC.
Garret
Garret Wilson wrote:
I just installed Tomcat 5.5.0 on Windows XP Professional
SP2. I have an
existing application that worked under Tomcat 4.x. It consists of a servlet in a jar file located here:
\tomcat\common\lib\myservlet.jar
That jar contains a servlet mapped to, for example:
<servlet-mapping> <servlet-name>myservlet</servlet-name> <url-pattern>/myservlet/test</url-pattern> </servlet-mapping>
I have a resource bundle installed here:
...mywebapp\WEB-INF\classes\myresourcebundle.properties
My JSP files do the following with no problem:
ResourceBundle.getBundle("myresourcebundle");
However, when my servlet in my jar tries to execute the
exact same code,
I get:
java.util.MissingResourceException: Can't find bundle for base name myresourcebundle, locale en_US
java.util.ResourceBundle.throwMissingResourceException(Resourc
eBundle.java:837)
java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:727) java.util.ResourceBundle.getBundle(ResourceBundle.java:577)
[etc.]
* I've tried taking my servlet out of a jar and putting it in ...mywebapp\WEB-INF\classes\
* I've tried copying my resource bundles to
...mywebapp\WEB-INF\classes\
to the same subdirectory as the actual classfiles (even
though I'm using
a non-hierarchical resource bundle name: "myresourcebundle")
* I've tried creating an explicit myresourcebundle_en_US.properties
The only thing that works is to comment out the ResourceBundle.getBundle(); line from my servlet.
I've looked at the generated JSP source code from Tomcat,
and they have
the same ResourceBundle.getBundle(); as does my servlet.
Why can my JSP files find my resource bundle, yet my servlet can't?
Garret
P.S. I'm sure that this worked under Tomcat 4.x. Then
again, Tomcat 4.x
didn't issue an error when my JSP files imported a class
but didn't use
it, either.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]