tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Fischer <>
Subject Re: Configuring different environment variables for different vhost context?
Date Thu, 03 Sep 2009 20:46:04 GMT

Caldarale, Charles R wrote:
> I think you're confusing environment variables with environment entries - they are completely
different things.  Environment variables have a scope of process, and are accessed in Java
via System.getenv().  Environment entries (what you have configured) have a scope of webapp,
and are retrieved via JNDI lookup.  Read the servlet spec.

I think you're absolutely right; I'm sill new into all that Java/Tomcat

I searched a bit in the Hudson sources and found the following:

// check JNDI for the home directory first
try {
    InitialContext iniCtxt = new InitialContext();
    Context env = (Context) iniCtxt.lookup("java:comp/env");
    String value = (String) env.lookup("HUDSON_HOME");
    if(value!=null && value.trim().length()>0)
        return new File(value.trim());
    // look at one more place. See issue #1314
    value = (String) iniCtxt.lookup("HUDSON_HOME");
    if(value!=null && value.trim().length()>0)
        return new File(value.trim());
} catch (NamingException e) {
    // ignore

Matching that with your comment about JNDI, I see a partial match here
:) However I lack the knowledge to understand what the context lookup to
"java:comp/env" really means in relation to HUDSON_HOME .

Am I still on the right track now with my environment entry
configuration from my ROOT.xml? I can imagine that I'm missing only a
small link now ...

thank you in advance,
- Markus

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message