tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lempinen Sami (NET/Tampere)" <>
Subject Re: loading a properties file - where does it expect the file to be?
Date Thu, 28 Sep 2000 06:42:12 GMT

On Wed, Sep 27, 2000 at 08:04:23AM -0500, EXT Jacob Kjome wrote:
> The problem is, this isn't a servlet.  It is just a Class that I import 
> into the servlet and instantiate to communicate with an ldap directory 
> server.  I just had it in the same directory as the servlet for convenience 
> and this works on my 3.1 install and it always works when I run it as an 
> application from the command line.

To reiterate my previous message:

The concept of current working directory is undefined in a servlet
context. If the file was found when using 3.1, it was either a) sheer
luck or b) Tomcat had been started so that the working directory
magically matched your servlet context.

You have two ways around this (like I previously suggested):

- Somehow pass the servlet context path to your class so that you can
find the file relative to that, or,
- Use a ResourceBundle instead of Properties. The Bundle is found if
it's in the CLASSPATH.


Sami Lempinen <>
OSS Monitor / NMS Infoware Technologies
Blame Canada.

View raw message