Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


share|improve this question
Are you talking about different stages for one application or different tomcat instances for different applications? – Christian Jan 8 '10 at 21:17

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

./bin/ -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:

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.

share|improve this answer
up vote 0 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.