IT Certificaions

Google Cloud Platform

Friday, August 28, 2015

Set your application context path in Tomcat 7

Set Context path in Tomcat 7 or more using catalina.properties file,

Step 1)
Add following lines to catalina.properties file under <tomcat-install dir>/conf directory,

#myApp war file version
myApp .war=myAppLive -1.0.0.1.war
myApp .path=/myAppLive

#application deployment location
appBase=webapps

Step 2)
Now update context path in <Host> node in server.xml file in same location,
<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="false">
...
....  
 <Context path="${myApp .path}" docBase="${catalina.base}/${appBase}/${myApp .war}"/>
...
....

</Host>