1

Right now, all application-specific configuration is done in conf/Catalina/localhost/myWebApp.xml, and this file changes between different deployment scenarios (test/production/personal, etc). My initial thought was to create multiple configuration files named for the explicit configuration. Ideally, these deployment-specific configuration files would be interchangeable. That is, a switch of a configuration file containing parameters that change between deployments would be the only configuration change needed to switch a deployment.

What's the best way to go about doing this? Can I override properties with tomcat? How can I use more than one configuration file for a webapp context? If I can override, how do I specify override precedence?

Thanks.

Stefan Kendall
  • 1,069
  • 3
  • 17
  • 33
  • Are you talking about different stages for one application or different tomcat instances for different applications? – Christian Jan 08 '10 at 21:17

2 Answers2

1

From the core server end, you can pass in the Tomcat configs itself at startup instead of it using the defaults, like so:

cd $TOMCAT_HOME
./bin/startup.sh -config /some/path/to/server.xml

This server.xml defines your 'host' element for the webapps which has several properties as to how they are deployed (take a look at the default one). The config docs are here:

http://tomcat.apache.org/tomcat-6.0-doc/config/host.html

Take a look a little further down in that doc for where it starts talking about "Automatic Application Deployment" -- there's some verbiage that starts talking about different XML files. Perhaps one of these defined procedures the engine has will allow create a working scenario for your needs; I've not done exactly as you request though, typically a WAR is deployed that contains it's own XML and is auto-unpacked - I don't mess with overwriting post-unpacked files in the webapps/foo/ areas.

0

The best thing you can do, apparently, is to build a variable parsing engine that creates multiple deployment files for the different deployments you need.

Stefan Kendall
  • 1,069
  • 3
  • 17
  • 33