Tomcat Set Context Path for Web Application

Add a file called ROOT.xml in $CATALINA_BASE/conf/Catalina/localhost/

This ROOT.xml will override the default settings for the root context of the tomcat installation for that engine and host (Catalina and localhost).

Enter the following to the ROOT.xml file:

<Context docBase="<yourApp>" path="" reloadable="true"/>

reloadable default value is true

Here, is the name of your app

And there you go, your application is now the default application and will show up on http://localhost:8080

However, there is one side effect; your application will be loaded twice. Once for localhost:8080 and once for localhost:8080/yourApp. To fix this you can put your application OUTSIDE $CATALINA_BASE/webapps and use a relative or absolute path in the ROOT.xml's docBase tag.

<Context docBase="/opt/mywebapps/<yourApp>" path=""/>

Comments

Popular posts from this blog

Reduce TIME_WAIT Socket Connections