There are three methods:
-
First shutdown your Tomcat from the its
bindirectory (sh shutdown.sh). Then delete all the content of your Tomcatwebappsfolder (rm -fr *). Then rename your WAR file toROOT.war, and finally start your Tomcat from thebindirectory (sh startup.sh). -
Leave your war file in
$CATALINA_BASE/webappsunder its original name. Turn off
autoDeploy and deployOnStartup in your Host element in theserver.xmlfile.
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.xmlin$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.xmlfile, in this
caseROOT.xml. See the documentation for the Context container for details.
Reference