Two Laptop Bag*
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 Murach's Java Servlets and JSP this week in the Servlets 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?
Consider Paul's rocket mass heater.
subject: Advice on deploying WAR file
Similar Threads
Ant Undeploy Problem
Tomcat War
Deploying .war file in tomcat
i am a tomcat idiot. Need help using context roots
Problem deploying WAR file with a context.xml