Tomcat – Sometimes Tomcat doesn’t re-deploy on startup

bugdeploymentstartuptomcattomcat7

The infamous rm -rf command is something we would rather avoid in Production, even if it's scripted. So if you have a war file named mywebapp.war and a directory its deployed to under webapps/ that is called webapps/mywebapp/ how can you force a re-deployment without using rm -rf webapps/mywebapp/ The Tomcat bug is intermittent and hard to reproduce so I'm trying to plumb the depths of community experience for tricks that are known to work.

What about:

  • Setting the access date on the war or the deployment dir and/or it's contents just prior to startup?

  • Sending a Unix signal to the Tomcat process?

  • Other?

We are kind of hidebound with the use of scripts rather than something like the Tomcat Deployment Widget so I'm looking for script-able options that will not result in a all-out rebellion. 😉

Best Answer

You can just touch your_app.war Tomcat will do redeploy right away.

If you are concerned about protecting timestamps for .war files (which is a good idea) you can keep a symlink from webapps dir to the actual location of .war file and touch the symlink.