This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have a problem with redeploying a WAR in Tomcat 5.5.20. Every time I drop a WAR into the $CATALINA_HOME/webapps directory the application becomes unusable, pages and servlets return 404's. So I tried the struts-blank-1.3.5.war that comes packaged with Struts and I get the same behavior: -Drop the WAR into $CATALINA_HOME/webapps and it gets deployed:
Usually that happens due to resource locking if developing on Winbloze. You should create a context for your webapp and apply a antiJARLocking="true" and antiResourceLocking="true" attributes for the context.
What's usually happening is during the undeploy process not everything is deleted so it can't redeploy the locked resources. I also create my context to point to my project folder where I maintain an "exploded" working copy of my webapp. So I have reloadable="true" for my context. Anytime I change a class file, tomcat reloads my webapps automatically. Also, because I work in a "hot" directory structure, I don't have to do a redeploy just to see changes I've made to JSP, CSS, etc.
I added those flags to my context file but when I do a redeploy it deletes the context file. But the application is usable after the redeploy. I also tried using my build directory as the doc base as declared in the context below but it doesn't seem to catch on that web.xml has changed.
No, it won't catch config changes even though you would think it would with the watched resource param. I've never gotten that to work. Only classpath changes. You shouldn't really be messing with your web.xml file much after you get going anyway, so that won't be a big deal.
As far as the context file deletion, create a folder called META-INF in your project and put in there a context.xml file. In that file, specify your context config. Make sure you include that folder when you create the WAR file. When the war is deployed, the context.xml will be moved to