tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject Re: Can I pass values to application configuration file on command line
Date Thu, 24 Jul 2008 04:14:45 GMT

"Jim Cant" <cant_jim@hotmail.com> wrote in message 
news:BAY110-DAV1156815676349F47F494AAE6840@phx.gbl...
> Is there a way I can use replaceable parameters in an application's xml
> configuration file and pass a value in on the Tomcat command line.  In
> particular, I would like to set the value of docBase so that I can launch
> tomcat and have it find my app in different locations without having to 
> edit
> the xml config file.
>
> For example, in the application config file
>       (say, $TOMCAT_HOME/conf/Catalina/localhost/myAppConfig.xml)
> put something like
>
>    <Context path="/theAppPath"    docBase="${APP_PATH}" ...
>
> so that ${APP_PATH} (or whatever the correct syntax is) gets replaced when
> Tomcat is started with something like
>
>    $TOMCAT_HOME/bin/startup  ... -DAPP_PATH=/my/app/lives/here ...
>

This won't work, but (assuming that you have a reasonably receint Tomcat) if 
you create a setenv.sh in the $CATALINA_HOME/bin directory that includes:
  CATALINA_OPTS="-DAPP_PATH=/my/app/lives/here"
  export CATALINA_OPTS
then Tomcat will perform the variable replacement when parsing the 
context.xml file.

> and have the value for the variable replace the placeholder in the config
> file.
>
> Thanks a lot,
>
> Jim Cant
>
>
>
>
>
> ---------------------------------------------------------------------
> 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
>
> 




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