• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tomcat Redeploy Breaks Struts App

 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:

-Point a browser at http://localhost:8080/struts-blank-1.3.5/ and I see some greeting text.
-Touch the WAR to force Tomcat to redeploy:

-Note that the redeploy is not as verbose as the deploy
-Navigate to http://localhost:8080/struts-blank-1.3.5/ and get a 404.

Stopping Tomcat and removing the exploded directories is really slowing down my development. Anyone else see the same thing?
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

[ January 12, 2007: Message edited by: Joe Ess ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

%TOMCAT_HOME/conf/Catalina/localhost/appname.xml

where appname is your context path as in

http://localhost:8080/appname

hth
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Gregg Bolinger:
No, it won't catch config changes even though you would think it would with the watched resource param.




I finally found the Context in the Tomcat documentation. Linked off the JNDI How-To. They sure don't make it easy.
Thanks for the help Gregg.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic