This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Problem reading property file -- Linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Problem reading property file -- Linux " Watch "Problem reading property file -- Linux " New topic
Author

Problem reading property file -- Linux

Bhiku Mhatre
Ranch Hand

Joined: Apr 08, 2002
Posts: 127
Hello,
I am reading a property file from my java application. The code works fine fine Under Windows 2000, WebSphere studio.
But when I deploy it on tomcat running under German Linux it fails to load the property file.
Properties prop = new Properties();
Locale locale = new Locale("de","DE");
ResourceBundle bundle = ResourceBundle.getBundle("myproperties",locale);
Enumeration enum = bundle.getKeys();
String key = null;
while( enum.hasMoreElements() ) {
key = (String)enum.nextElement();
prop.put(key, bundle.getObject( key ));
}

It throws Exception java.util.MissingResourceException : Can't find bundle for base name myproperties.
My property file resides in document root of the web application.
Any help is appreciated.
T
hanks in advance,
Regards,
Bhiku.


The difference between winner and loser is making things happen and letting things happen.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I can imagine that you used e.g. MyProperties.properties as filename.
On windows this is ignored, but linux differs between capital and small
letters.
Bhiku Mhatre
Ranch Hand

Joined: Apr 08, 2002
Posts: 127
Hello,
Thanks a million for your quick reply. But the file name in both code and on disk is in lowercase.
Thanks once again,
Regard,.
Bhiku.
Wayne L Johnson
Ranch Hand

Joined: Sep 03, 2003
Posts: 399
I use Tomcat (on Windows and Linux) and my properties file always goes in the ...\WEB-INF\classes directory [or a sub-directory if I include a path name in the .getBundle(...) class].
Also, what is the name of your properties file? You might try "myproperties_de.properties" or even "myproperties_de_DE.properties".
Bhiku Mhatre
Ranch Hand

Joined: Apr 08, 2002
Posts: 127
Thanks Wayne, It has worked.
Warm regards,
Bhiku.

Originally posted by Wayne L Johnson:
I use Tomcat (on Windows and Linux) and my properties file always goes in the ...\WEB-INF\classes directory [or a sub-directory if I include a path name in the .getBundle(...) class].
Also, what is the name of your properties file? You might try "myproperties_de.properties" or even "myproperties_de_DE.properties".
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem reading property file -- Linux
 
Similar Threads
Problem reading property file -- Linux
3 Features of Java for Internationalization
MissingResourceException due to class loader constellation (caller not in WEB-INF/classes)
How to access a properties file values in Spring 3?
Writing in Properties File form Servlet