You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bryce Nesbitt <br...@obviously.com> on 2006/09/12 07:14:39 UTC

HowTo question: Setting java system properties in web.xml?

Hi all;
This is a question about setting java system properties, especially in
web.xml.

I have a legacy application that reads Java system properties:
    System.getProperty("com.foo.timezone")

Which were once on the command line:
    JAVA_OPTS="-Dcom.foo.timezone=America/Los_Angeles"

Or in resin.conf:
    <system-property com.foo.timezone="America/Los_Angeles"/>

Now that I'm moving to tomcat5, how can I get the same functionality, on
the assumption than I can control only the webapp (not the tomcat
instance)?  I need some file I can tweak on a per-webapp basis.

I'll put the answer up at:
http://wiki.apache.org/tomcat/HowTo#head-45c3314139cb900ddd43dde2ff671532e6e844bc

                            -Bryce Nesbitt
                            http://www.obviously.com/


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


Re: HowTo question: Setting java system properties in web.xml?

Posted by Tim Funk <fu...@joedog.org>.
There is no way to do this in tomcat. The alternative is the link you 
provided
http://wiki.apache.org/tomcat/HowTo#head-45c3314139cb900ddd43dde2ff671532e6e844bc

OR
Use JNDI to do the lookup. You'll do this via *|*<env-entry> in web.xml 
Then this environment entry can be set in web.xml or overridden in 
tomcat's context config.*|*
http://tomcat.apache.org/tomcat-5.0-doc/jndi-resources-howto.html

-Tim

Bryce Nesbitt wrote:
> Hi all;
> This is a question about setting java system properties, especially in
> web.xml.
>
> I have a legacy application that reads Java system properties:
>     System.getProperty("com.foo.timezone")
>
> Which were once on the command line:
>     JAVA_OPTS="-Dcom.foo.timezone=America/Los_Angeles"
>
> Or in resin.conf:
>     <system-property com.foo.timezone="America/Los_Angeles"/>
>
> Now that I'm moving to tomcat5, how can I get the same functionality, on
> the assumption than I can control only the webapp (not the tomcat
> instance)?  I need some file I can tweak on a per-webapp basis.
>  
>   


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