You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Michael D. Spence" <sp...@panix.com> on 2003/09/18 16:57:21 UTC

Where should I put properties files

I have a web service (call it XYZ) which requires a .properties file.  I had
been putting it in
%CATALINA_HOME%\webapps\axis\services\XYZ, with the classes in
%CATALINA_HOME%\webapps\axis\services\WEB_INF\classes and using this to
open the properties file.

    File PFile = new File("webapps" + File.separator +
                          "axis" + File.separator +
                          "services" + File.separator +
                          "XYZ" + File.separator + "XYZ.properties");

    if (!PFile.exists())
      throw new CFException("No properties file: " +
PFile.getAbsolutePath());

This works, but there are two problems:

1) If Tomcat is run as a service, I have to put the properties file in
%CATALINA_HOME%\webapps\axis\services\XYZ, instead.

2) I recently ditched the classes and put XYZ.jar into
%CATALINA_HOME%\webapps\axis\services\WEB_INF\lib.  Now, unless I hard-code
a path for the properties file (e.g., C:\XYZ.properties), the service can't
find it.

How is this issue normally handled?

Michael D. Spence
Mockingbird Data Systems, Inc.