0

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

0

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" />
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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