tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alyssa Kwan <alyssa.c.k...@gmail.com>
Subject Setting Environment Variable for Tomcat 6 Servlet
Date Fri, 21 Jan 2011 21:29:49 GMT
Hi All,

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?

Thanks!
Alyssa
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message