I'm using Maven with Tomcat under Windows XP, and I've been having trouble hot-deploying.
I tried to hot-deploy using the code:
But I started running into a bunch of issues where the project could not be deployed properly. The only way I could get it to work was to undeploy the WAR, stop Tomcat, Start Tomcat, and deploy the WAR again. What a pain!
My colleague Amandeep wasn't having the same trouble on his Mac, even though I was using Tomcat 6.0.18 and he's using 6.0.16. Turns out, it's a file-locking issue that only shows up under Windows. To fix it:
Edit %CATALINA_HOME%\conf\context.xml. Find the root <Context> and add these two attributes:<Context antiJARLocking="true" antiResourceLocking="true">
Thanks to Aman and Richard Conway on theserverside.com for the tips.