Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem reading property file -- Linux

 
Bhiku Mhatre
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic