tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Reuse JNDI Properties
Date Mon, 03 Dec 2012 15:27:08 GMT
Hash: SHA1


On 12/3/12 8:03 AM, Martin Gamper wrote:
> Hey everybody!
> I am looking for a solution to reuse a JNDI Property which is set
> in the context.xml : in my "${catalina.home}/conf/context.xml"
> following <Environment name="nodeName" type="java.lang.String" 
> value="superFantasticNode" override="false" /> I use this value for
> several different purposes.
> Now I want to define (for my J2EE application) another value for
> special Log- Files. And therefore I use another JNDI property ...
> and in this Property I'd like to "reuse" the previously set
> "nodeName"-variable.
> In my Fantasy it would work like this: <Environment
> name="loggingPath" value="${catalina.home}/logs/${nodeName}.log" 
> type="java.lang.String" override="false" />
> But it does not.

Tomcat has a very limited set of cases where ${...} will do
replacements for system properties. I think it's definitely worth
filing an enhancement request for this kind of thing: it's a *very*
useful feature to have.

> Do you know any solution (despite from changing my code) to achieve
> this?

I would do a search-and-replace as part of the deployment process. Is
this something that does into META-INF/context.xml (at the webapp
level) or into conf/context.xml (at the server level)?

If at the webapp level, you'd have to re-roll a WAR file for each
server you want to target. That's not necessarily a big deal: you can
script it with ant or even bash if you want (unzip, replace, update-zip).

I guess the same thing could be done at the server level, though it
would only have to be done once each time you install (or upgrade) Tomcat.

- -chris
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools -
Comment: Using GnuPG with undefined -


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

View raw message