Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

How to configure in Tomcat?

Xi Chen

2006-03-15

Replies:

Hi, there. I have a question in my deployment under Tomcat 5.5.

In one of the java classes I wrote, I have a line of code like the following:

   String propertiesFilePath = System.getEnv("MY_CONFIG_FILE_PATH");

    // Then I start load the contents of the file into java Properties.


I set up the environment variable (MY_CONFIG_FILE_PATH) correctly on
the machine, and the class function all right if I test it via a
command line.

However, if I test the class under Tomcat (after deploy the class to
the appropriate path under Tomact) on the same machine, it complains
that it cannot find the path.

Given that result, I speculate that Tomcat has no way to know the
environment variables. Am I wrong?  Is there anyway to configure
Tomact (e.g. setting a config variable like "MY_CONFIG_FILE_PATH"
under Tomcat), so that all the deployed knows the value of the
"MY_CONFIG_FILE_PATH".

All I want to achieve is that:

 Put all the needed SQL queries in a properties file and let java
classes retrieve the queries from the properties file (in stead of
using hard-coded queries in the source code).

It seems to me to deploy the properties file under the Tomcat is a bit
challenging.

Any guidance will be highly appreciated!


--
Don Chen

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.