Tuesday, September 15, 2009

How to configure context path (web app url) in tomcat 5

Sometimes we want to change the context path

from http://localhost:8080/mywebapp
to http://localhost:8080/somedir/otherdir/newcontext

Just follow the steps:

1) create folder configwebapp, under Catalina_home/webapps

2) copy war to Tomcat_home/webapps/configwebapp/mywebapp

3) make following entry into Tomcat_home/conf/server.xml (just above – closing of Host)

……
……

< Context path="/somedir/otherdir/newcontext"
docBase="C:/apache-tomcat-5.5.23/webapps/configwebapp/mywebapp"
reloadable="true" >
< /Context>



Restart tomcat !

----------------------------------------------------------------------------------