tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kaj Kandler <KajKand...@conficio.com>
Subject Re: Setting Java property inside a webapp
Date Wed, 14 Nov 2007 19:48:10 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanks Christopher,
I appreciate the quick response.

Trickily I can't change the library (forgot to mention that), so I have
to depend on the property value and can't change it to a JNDI lookup.

Well, I did the following:
As I use Spring anyway, I created a bean property, that if set will also
set the JVM property, not too great, but should work, as the value is
global for all in the tomcat.

Any objections to this?

K
Christopher Schultz wrote:
> 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

- ---------------------------------------------------------------------
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


- --

*** Technical support for non technical users of OpenOffice.org ***
*** http://plan-b-for-openoffice.org/                           ***
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)

iD8DBQFHO1D6RDUvrJRNjTARApZ1AJ99GF0fhQ5k5GqRma/8sy2mrYAx0ACdGxst
sEipX/PgkXhRwqHxjX1PB24=
=f30a
-----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