Indra Bahadur Singh
Indra Bahadur Singh

Reputation: 51

To deploy a web application outside webapps folder in tomcat 7

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?

Upvotes: 5

Views: 2855

Answers (2)

Anshul Sood
Anshul Sood

Reputation: 71

 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

Upvotes: 2

Christopher Schultz
Christopher Schultz

Reputation: 20882

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).

Upvotes: 1

Related Questions