This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Tomcat and the fly likes can't find properties file problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "can Watch "can New topic

can't find properties file problem

Denise Hum

Joined: Oct 09, 2001
Posts: 20
I'm running Tomcat 5.5.9 and I'm trying to load a properties file, "" from within my application. I searched the previous threads and tried those suggestions, but it's just not working for me. Here is the code that I am trying to run.

It is finding that inStream is null. I tried putting in the WEB-INF/classes directory as well as the directory that this class is in and it's still not finding it. Any ideas? Thanks.
Stian Almaas
Ranch Hand

Joined: Sep 22, 2005
Posts: 33
Try running this:

That should show you the working directory for your server user.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410


Look at the third item on this list for instructions on loading properties files using ServletContext.getResourceAsStream.
Tomcat uses custom classloaders and may not work the way your expecting it to.

The link also shows how to load the properties file as a resourceBundle.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Consider Paul's rocket mass heater.
subject: can't find properties file problem
Similar Threads
JSF 2.0 - PropertyNotFoundException
PropertyNotFoundException in Hibernate
PropertyNotFoundException exception