|
Hey guys-
I'm trying to figure out way to separate my
initialization parameters from my application.war file. Because certain things
are different between dev, qa and live machines (such as database hostname,
username, password, etcs), I rather not put these values in the web.xml file.
(The web.xml would be stuck in the application.war file and I don't want the
deployment people to unjar it in a deployment setting to change the values of
web.xml).
So, I'm looking at trying to setup my own
properties file that a singleton class would read in my web application and set
as global variables for all my servlets/jsps. However, I'm having trouble
writing the code to open up the properties file. I'd like to put the properties
file in %TOMCAT_HOME%/settings directory (I made this directory up and added it
to the classpath in my tomcat.bat file).
From some previous posts on this list, I'm trying
:
InputStream stream =
this.getClass().getResourceAsStream("testApp.properties");
But it fails. If I use a File stream and point
right at the file, it does load. Just as a test, I tried copying this file to
the same location where the class was, as well as myapplication/WEB-INF/classes
and myapplication/WEB-INF/lib, and still could not get the file
loaded.
What would be the proper way to have this loaded
(preferably in the settings directory since I can't rely on my war file being
unjar'd by future tomcats).
BTW- I'm using Tomcat 3.2.1 in Standalone, Win2K,
JDK1.3.
Thanks in advance,
JP
|
- Re: getResourceAsStream - properties files Java Poop
- Re: getResourceAsStream - properties files Craig R. McClanahan
- Re: getResourceAsStream - properties files Java Poop
- Re: getResourceAsStream - properties files Java Poop
