Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

How can I auto-deploy a WAR file (created by Play! framework, by the way) to Tomcat 6, but on an arbitrary URL such as "/sub/url", and without changing the WAR filename?

I know I can simply upload it as "sub#url.war" and Tomcat will automatically deploy it to "/sub/url", but my filename contains a special site identifier so I would like to keep the filename even if the URL changes.

Lets assume the filename is "specialfilename.war".

I also tried to add a META-INF/context.xml file to the WAR

<Context path="/sub/url" />

but that does not get used in any way. Tomcat copies that file to "conf/Catalina/localhost/specialfilename.xml" but the specified URL path does not affect anything. My application keeps getting auto-deployed to "/specialfilename".

share|improve this question
up vote 0 down vote accepted

Thanks to a mailing list response, I found a way to do what I want.

The solution is to not use the auto-deploy feature for WAR files in "/var/lib/tomcat6/webapps", but instead uploading the WAR file to another directory. Then one must explicitly create a context configuration file matching the URL path, e.g. "/var/lib/tomcat6/conf/Catalina/localhost/sub#url.xml" with this content:

<Context docBase="/path/to/war/arbitrary-filename.war" />
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.