How do I deploy a WAR file in Tomcat?

Alex Chaffee

Currently (as of version 3.2) the procedure for deploying a new WAR file is:

  1. Stop Tomcat.
  2. Delete existing deployment. If you have previously deployed "foo.war" in TOMCAT_HOME/webapps, then it has been unpacked into webapps/foo/... You must delete this directory and all its contents. On Unix, this can be done with
    rm -r $TOMCAT_HOME/webapps/foo
  3. Copy WAR file to TOMCAT_HOME/webapps/.
  4. Start Tomcat.

This process may become easier in the future. A "deploy tool" is on the Tomcat "to-do" list.

Note that if you deploy a WAR file in this manner, you do not need to make any changes to server.xml -- it will automatically be recognized and activated. However, if you wish to specify non-default options for this webapp, you may do so by adding an element like

<Context docBase="webapps/foo" ...
to server.xml.