You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Stuart Farnan <st...@neoworks.com> on 2000/11/17 15:27:22 UTC
System properties
Hi,
I was wondering if it is possible to pass properties to Tomcat. I have some
classes which read various system properties in their static initializers,
and this works fine when using these classes on the command line using "java
-Dproperty=value". However I am not sure how to pass these properties into
tomcat when I start it. Is there something in one of the XML files?
Thanks,
Stuart
______________________________________________
Stuart Farnan stuart@neoworks.com
NeoWorks Ltd +44 (0)20 7637 5429
Re: System properties
Posted by Rachel Greenham <ra...@enetgroup.co.uk>.
On Friday 17 November 2000 14:27, you wrote:
> Hi,
>
> I was wondering if it is possible to pass properties to Tomcat. I have
> some classes which read various system properties in their static
> initializers, and this works fine when using these classes on the command
> line using "java -Dproperty=value". However I am not sure how to pass
> these properties into tomcat when I start it. Is there something in one of
> the XML files?
yes, you can do it, by supplying it in TOMCAT_OPTS when invoking Tomcat.
However, it's ugly and results in non-portable web applications (you need to
set the properties on whatever servlet container is being used, and restart
it, and some may not allow you to set such things). It would be *better* to
put the properties you want into some config file specific to your web
application, in WEB-INF, to be loaded through ServletContext.getResource(),
or as servlet init parameters. Static initialisers? Ugh. Specify instead that
your servlets are to be initialised and get the data then. Self-containment
is the watchword for web applications.
--
Rachel