• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Problem reading property file -- Linux

 
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.
 
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.
 
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
Boost this thread!