• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

placing propertie file in .war file

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have created one properties file, in my application iam trying to read the properties file.i have placed the properties file in web-inf/ folder.
when i deploye the application,its giving me the FileNotFoundException.

could you please help where should i place the properties file,and how to read the properties file from java classes.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
WEB-INF is the private folder in your tomcat..
you need to place the properties file in the classes folder ie
WEB-INF/classes/
 
srikanth singamsetty
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can read the properties file by the help of ResorseBuldle
which is existed in the java.util package
sample code to read the properties file
java.util.ResourceBundle resBundle = ResourceBundle.getBundle("PropertiesFilename");

/*
* please save the properties file with .propeties extension and place it in the WEB-INF/classes folder
*/
resBundle.getString("keyhere");
 
suresh pulapally
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I tried using ResourceBundle.i have placed .properties file in web-inf/classes folder, and the following code i have written to get property value.
java.util.ResourceBundle resBundle = ResourceBundle.getBundle("application.properties");
String jndi_name=resBundle.getString("jndiname");

its throwing following exception.
java.util.MissingResourceException: Can't find bundle for base name application.properties

Thanks
Suresh
 
Ranch Hand
Posts: 724
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try only application without properties extension
 
suresh pulapally
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks,
Its working fine
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic