You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Justin Nichols <ju...@commerceengine.com> on 2001/08/14 17:10:29 UTC

Resource Bundle issues

Here's what I'm using:
Tomcat 3.2.3
JDK 1.3

Ok...here's a problem I'm having:

I am trying to use a ResourceBundle to get configuration data for the system.
The file I have is called foo.properties and the contents of the file is as 
follows:
	key=value

I then put foo.properties in WEB-INF/classes because WEB-INF/classes and 
WEB-INF/lib are put into the classpath by tomcat by default, or at least it 
is supposed to.

Now from a servlet somewhere in WEB-INF/classes, I attempt to create a 
ResourceBundle using the static .getBundle("foo") method which should return 
a reference to a PropertyResourceBundle and thusly should allow me to get the 
keys and values from the foo.properties file.

What is happening is I am getting a MissingResourceException when it tries to 
do .getBundle().  However, if I add the path to foo.properties explicitly in 
the classpath, it work perfectly.  It looks to me like WEB-INF/classes isn't 
getting put into the classpath correctly when tomcat starts up, but 
jasper.log shows that it is.

I even tried to put foo.properties into a jar file and put that into the 
WEB-INF/lib directory but with no luck there either.

I'm looking for reasons why this is happening and how to correct it, not just 
ways around it.

Any answers, ideas, etc?

Thank you,

Justin Nichols
justin@commerceengine.com