Blog : Configure Context Root in Apache Tomcat Server

May28


 

This is a simple issue you may face when you work with Tomcat Server (Any version)

Issue

I have a web application with name MyApp,  I created a WAR file and deployed in Tomcat. Now you can access the application as http://localost:port/MyApp/…

How can you change the context root in URL to some thing else?

Solution

Very Simple ,

1.  Go to Tomcat Installation dir/conf/server.xml

2.  Under <Host ….> Add (or Edit if is already existing)
<Context path=”/” docBase=”MyApp” />

Now your URL will be http://localhost:port/

You can change path to anything you want


<Host name="localhost" appBase="webapps"

unpackWARs="true" autoDeploy="true"

xmlValidation="false" xmlNamespaceAware="false">

Full Code

<Host name=”localhost” appBase=”webapps”       unpackWARs=”true” autoDeploy=”true”    xmlValidation=”false” xmlNamespaceAware=”false”> <Context path=”/” docBase=”MyApp” />

….

</Host>

Other servers like IBM Webphere you can change context root in EAR File/META-INF/application.xml


Join Indian Community is USA
Posted in Software / Software category on May 28 2010, 12:38 AM
546 Views, 0 Comments, 1 Appreciations, Overall rating:
Tags: Software, Server, Tomcat, Webserver
Post a comment | Appreciate this post | Report abuse |

Comments


 
X