Tomcat – How to change the ROOT application


I'm trying to change the default application of a Tomcat 6 webserver to a different application than "ROOT" (inside webapps folder). What is the best way to do this?

Best Solution

There are three methods:

  • First shutdown your Tomcat from the its bin directory (sh Then delete all the content of your Tomcat webapps folder (rm -fr *). Then rename your WAR file to ROOT.war, and finally start your Tomcat from the bin directory (sh

  • Leave your war file in $CATALINA_BASE/webapps under its original name. Turn off autoDeploy and deployOnStartup in your Host element in the server.xml file. Explicitly define all application Contexts in server.xml, specifying both the path and docBase attributes. You must do this because you have disabled all the Tomcat auto-deploy mechanisms, and Tomcat will not deploy your applications anymore unless it finds their Context in the server.xml.

    second method: in order to make any change to any application, you will have to stop and restart Tomcat.

  • Place your WAR file outside of $CATALINA_BASE/webapps (it must be outside to prevent double deployment). Place a context file named ROOT.xml in $CATALINA_BASE/conf/. The single element in this context file MUST have a docBase attribute pointing to the location of your WAR file. The path element should not be set - it is derived from the name of the .xml file, in this case ROOT.xml. See the documentation for the Context container for details.


Related Question