tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Reuse JNDI Properties
Date Mon, 03 Dec 2012 15:27:08 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin,

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlC8xMwACgkQ9CaO5/Lv0PD/yACcDehCXdQwQv0DepMXvoKjNrIs
YSEAoKuitDvT3ziCeV3tYh/nkSVMLRzn
=5me9
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message