Win a copy of Spring Boot in Practice this week in the Spring forum!
  • 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

properties file

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
i am writing a servlet which access a database using properties file.the error is it is not able to find the properties file.
so could u please tell me where should i keep the properties file
iam using jbuilder.
when i gave completepath like c:\..\...it is giving error null pointer exception.
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by chandra t:
hi
i am writing a servlet which access a database using properties file.the error is it is not able to find the properties file.
so could u please tell me where should i keep the properties file
iam using jbuilder.
when i gave completepath like c:\..\...it is giving error null pointer exception.



Why don't you set the property inside the Servlet (using the System.setProperty method)? A better technique is to use a datasource.
As far as the specifics, I am afraid they are a bit servlet specific. You might try putting the properties file in the same directory as the servlet class file, but then this might pose a security risk.
 
chandra t
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank u robert.
i got that.we can place property file any where and we can give the complete path.
and if we want to put the property file anywhere we have to set the path in classpath and can access the prperty file using System.getProperty
cheers
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic