Setting Environment Variable for Tomcat 6 Servlet
- by amaevis
I'm using Ubuntu's default installation of Tomcat 6. I'm deploying a ROOT.war, and trying to set an environment variable specific to it, i.e. accessible from System.getenv() in the Servlet.init(config).
According to the docs (http://tomcat.apache.org/tomcat-6.0-doc/config/context.html), I can specify this in a Context element in conf/Catalina/localhost/ROOT.xml. I've created that with these contents:
<Context>
<Environment name="FOO" value="bar" type="java.lang.String" override="false"/>
</Context>
And I've deployed the webapp as usual, i.e. to webapps/ROOT.war.
Server.getenv("FOO") in the Servlet.init(config) still returns null. What am I missing?