Debian – Tomcat WatchedResource / auto-deploy ineffective

debiantomcat

My task involves deploying a Java web application into a Tomcat 6.0.35 instance running on Debian Squeeze. As such, Tomcat is installed from package sources and the web application is deployed from a custom .deb package that puts the .war file into a directory below /opt and registers it with Tomcat by dropping a context XML (let's call it my-app.xml) into /etc/tomcat6/Catalina/localhost/. This works fine for the initial .deb install where the application is picked up by Tomcat's auto deployment mechanism and unpacked into /var/lib/tomcat6/webapps/.

When re-installing a newer version of the .deb, Tomcat will not update the application, though. It will only detect a change if I manually execute a

touch /etc/tomcat6/Catalina/localhost/my-app.xml

Even restarting Tomcat without touching my-app.xml has no effect.

my-app.xml looks like this:

<Context path="/my-app" docBase="/opt/my-app/my-app.war">
    <WatchedResource>/opt/my-app/my-app.war</WatchedResource>
</Context>

IMHO, this should watch for changes of the .war (which changes when I install the updated .deb).

Autodeploy is turned on in server.xml.

Any ideas?

Best Answer

Put the touch line into the post-install script of your deb file