File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Advice on deploying WAR file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Advice on deploying WAR file" Watch "Advice on deploying WAR file" New topic

Advice on deploying WAR file

Andy Hahn
Ranch Hand

Joined: Aug 31, 2004
Posts: 225
Hi, I am wondering if someone could provide advice on the correct way to re-deploy a WAR file to Tomcat. I am running version 4.1.31.
Currently to deploy a WAR file I simply copy the WAR file to the <TOMCAT_HOME>\webApps directory. Then when I startup Tomcat the WAR file gets exploded. This all seems to work fine.
But how about if I want to re-deploy a new version of the WAR file? Do I have to delete the WAR file from <TOMCAT_HOME>\webApps AND from <TOMCAT_HOME>\webApps\<context_name>? Or do I just overwrite the WAR file in <TOMCAT_HOME>\webApps?
I have had some problems on startup in the past when I directly deleted the actual application context folder - <TOMCAT_HOME>\webApps\<context_name>.
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
Yes, you can go thru the motions of deleting the old war file and the directory that was created. Of course you will have to shutdown/restart TOMCAT everytime that is done.

I usually just use the manager status web interface to redeploy the application after I place the new WAR file in the ../webapps directory.
Andy Hahn
Ranch Hand

Joined: Aug 31, 2004
Posts: 225
I would like to go the route of deleting the WAR file and restarting Tomcat (however I will check out the manager status web interface for my home projects!).

The problem I am having occurs when I delete the <TOMCAT_HOME>\webApps\<context_name> directory.
Tomcat throws exceptions and will not start when I do this. I have found that this is because that application's context information is added to server.xml.
Also, the application context is copied to <TOMCAT_HOME>\work\Standalone\localhost\<context_name>.

So with all of that said, would it be ok to simply delete the WAR file from <TOMCAT_HOME>\webApps and leave <TOMCAT_HOME>\webApps\<context_name> undeleted?
It is sorta covered in the JavaRanch Style Guide.
subject: Advice on deploying WAR file
It's not a secret anymore!