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 17:40:19 GMT
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(ResourceBundle.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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message