Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

To deploy a web application outside webapps folder in tomcat 7

Tags:

tomcat

tomcat7

I'd like to deploy a web application in folder

C:\webApp

to Tomcat7.x instead of having a copy under

%TOMCAT_HOME%\webapps

Which configuration is required on tomcat server?

like image 649
Indra Bahadur Singh Avatar asked Oct 18 '22 15:10

Indra Bahadur Singh


2 Answers

 1. Create a file name <yourapp>.xml inside location    ${CATALINE_HOME}/conf/Catalina/localhost

 2. Add the below content in the xml file created above

<Context displayName="yourapp" 
     docBase="/path/to/yourapp"
     path="/yourapp"
     reloadable="true" />

3. Restart tomcat
like image 98
Anshul Sood Avatar answered Oct 28 '22 15:10

Anshul Sood


Have a look at the Tomcat configuration guide which shows you how to do this.

[Contexts can be defined in] individual files (with a ".xml" extension) in the $CATALINA_BASE/conf/[enginename]/[hostname]/ directory. The context path and version will be derived from the base name of the file (the file name less the .xml extension). This file will always take precedence over any context.xml file packaged in the web application's META-INF directory.

The context.xml file in this case must include a <Context> element with a docBase attribute pointing to the WAR file (or exploded WAR directory) where your application resides on the disk (in your case: C:\webApp).

like image 34
Christopher Schultz Avatar answered Oct 28 '22 16:10

Christopher Schultz