tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Setting Java property inside a webapp
Date Wed, 14 Nov 2007 18:17:10 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kaj,

Kaj Kandler wrote:
> Hi there,
> I do have a library, that uses a property to determine some
> configuration. As a straight Java program I would call
> 
> java -dmy.property=/my/value ...
> 
> How can I set this property in the context of a tomcat webapp, like in
> the web.xml or context.xml?

Neither web.xml now context.xml will set system properties. You /can/
have either of these files stick things into the JNDI context, though.

See
http://tomcat.apache.org/tomcat-5.5-doc/config/globalresources.html#Environment
Entries

for more information.

If you /need/ to use system properties, you could write a
ServletContextListener to peek into JNDI and copy those values into he
system properties of the JVM. Just remember that system properties are
JVM-global, whereas JNDI resources are private to the application. If
you deploy two applications with different settings within the same JVM,
they will interfere with each other.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHOzum9CaO5/Lv0PARAsg8AJ4iWd60tShzFj7VShmzQRLe6z5y/ACgoURm
uoCEuQN83X9e+vQIyL4qfAA=
=Sc1s
-----END PGP SIGNATURE-----

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


Mime
View raw message