Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How to redeploy a webapp that already exists

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings! I'm running Tomcat 6.0 as a Windows XP Service. I'm trying to redeploy a webapp by stopping tomcat, dropping a war file into the webapps folder that is newer than the exploded webapp, and then restarting tomcat. This doesn't work - tomcat does not remove the exploded webapp and seems to ignore the new war file. The following excerpt from tomcat docs implies that it will *not* work because my webapp *is* referenced by a Context Descriptor (and it needs to be because I have a Resource defined) - but I figure I don't understand thing correctly yet and that maybe it can work.

The following deployment sequence will occur on Tomcat startup in that case:

Any Context Descriptors will be deployed first.
Exploded web applications not referenced by any Context Descriptor will then be deployed. If they have an associated .WAR file in the appBase and it is newer than the exploded web application, the exploded directory will be removed and the webapp will be redeployed from the .WAR
.WAR files will be deployed



The only way to get it to work is to remove the exploded webapp (I also remove the one in tomcat's work folder but don't know if I need to). My host has autoDeploy="false" and deployOnStartup="true" (although I've tried other combinations). Is there any way to get tomcat to remove the old expoded webapp? Or, is there a best practice that I need to be educated on! Thanks! BTW, here's my context:




 
Saloon Keeper
Posts: 25463
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unfortunately, Tomcat sees the exploded and unexploded versions of the WAR as 2 separate webapps, and since that's a conflict, it always resolves by using the exploded version, even when it's older.

No, Tomcat will not delete the obsolete version. I use a shell script to do that as well as removing old log and work files.

You can eliminate the problem by configuring Tomcat to not explode the WAR, but that's about the best you can do.
 
Steve Dambrosio
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks very much for the info. What's your opinion on deleting the work folder? (in my case C:\Program Files\Apache Software Foundation\Tomcat 6.0\work\Catalina\localhost\<webapp>). It seems to work fine if I don't delete it but I see that tomcat leaves old files in there (compiled jsp's for example).

P.S. Hot deployment seems to work great (autoDeploy="true"). I can drop in a new war file and the app gets re-exploded before my very eyes, or I can delete the exploded folder and it gets recreated from the existing war.
 
Steve Dambrosio
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you say

No, Tomcat will not delete the obsolete version. I use a shell script to do that as well as removing old log and work files.

, are the work files you're talking about the ones in work/Catalina/localhost? I.e. when redeploying an existing application should I delete the application folder in work/Catalina/localhost?
 
Steve Dambrosio
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you say

No, Tomcat will not delete the obsolete version. I use a shell script to do that as well as removing old log and work files.

, are the work files you're talking about the ones in work/Catalina/localhost? I.e. when redeploying an existing application should I delete the application folder in work/Catalina/localhost?
 
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No.
 
Steve Dambrosio
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply Bear. Can I assume from your reply that I don't have to worry about what's in work/Catalina/localhost regardless of how I deploy? For example, I may deploy by deleting the old application folder in webapps and exploding the .war war file manually (using jar).
 
Bear Bibeault
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oops. I thought you were asking about the files in conf/Catalina, rather than work/Catalina. My bad.

Yes, if you want to make sure that you are starting off with a clean slate, remove the files in work/Catalina for the web app. (e.g. work/Catalina/localhost/whatever)

Unless you want to change settings, you don't need to worry about the files in conf/Catalina.
 
My favorite is a chocolate cupcake with white frosting and tiny ad sprinkles.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic