How to change the ROOT application?
There are three methods:
First shutdown your Tomcat from the its
bin
directory (sh shutdown.sh
). Then delete all the content of your Tomcatwebapps
folder (rm -fr *
). Then rename your WAR file toROOT.war
, and finally start your Tomcat from thebin
directory (sh startup.sh
).-
Leave your war file in
$CATALINA_BASE/webapps
under its original name. Turn off autoDeploy and deployOnStartup in your Host element in theserver.xml
file. Explicitly define all application Contexts inserver.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 theserver.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 namedROOT.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 caseROOT.xml
. See the documentation for the Context container for details.
Reference
In Tomcat 7 with these changes, i'm able to access myAPP
at /
and ROOT
at /ROOT
<Context path="" docBase="myAPP"/>
<Context path="ROOT" docBase="ROOT"/>
Add above to the <Host>
section in server.xml