Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer

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

Your Answer

 
discard

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.