Reputation: 4615
I use:
<context:property-placeholder location="file:${PROJECT_CONFIG_PATH}/project.conf" />
in my applicationContext.xml to get local config (one for development and another for production). PROJECT_CONFIG_PATH
is a system environment variable (not eclipse env).
It works: on Windows in Eclipse (Jetty) and on Unix.
It doesn't work: on Windows with Tomcat 6 (java.io.FileNotFoundException: ${PROJECT_CONFIG_PATH}\project.conf
)
Could someone please tell me why Tomcat on Windows doesn't see environment variables? And how could this be solved?
Thanks in advance!
Upvotes: 1
Views: 2651
Reputation: 7705
If Tomcat is being run as a service, you will need to use the tomcat configuration editor to set the variable.
Start->Programs->Apache Tomcat x.x->Configure Tomcat
Select the Java tab Add the variable under "Java Options" as:
-DPROJECT_CONFIG_PATH="c:/yourpath"
Click OK and then restart the tomcat service.
Upvotes: 1
Reputation: 6229
I don't think Tomcat's startup batch files inherit the parent environment. Not sure why, though.
Try setting PROJECT_CONFIG_PATH
in either catalina.bat or startup.bat in the Tomcat bin directory.
Upvotes: 0
Reputation: 1028
Try this ...
<context:property-placeholder location="classpath:/PROJECT_CONFIG_PATH/project.conf" />
Upvotes: 0