Skip to main content

Deploy application at ROOT(/) context in Tomcat

Tomcat has its own application with the name "ROOT" that is runing in the main root (/) context path, So when ever you install new tomcat and try to accesss http://localhost:8080/ then it will show you the default tomcat home page,


If you want to deploy you application at  http://localhost:8080/  then there is two way to do this

1. ROOT.war : Create your application war file with the name ROOT.war and place it in the [TOMCAT_HOME]/webapps/ directory and restart tomcat services

2. Server.xml : If you can't change the war file name then in server.xml file there is one context tag  that is use to map your application on any context

  • Remove the ROOT folder directory from [TOMCAT_HOME]/webapps/
  • Copy your application war file into the same directory , let suppose your application war file name is "app.war".
  • Edit the server.xml file located at [TOMCAT_HOME]/conf/server.xml, and add the context tag
    <Context path="/" docBase="app" reloadable="true"></Context>
docBase : Your application war file name
path : Context path at which you want to map your application , here I am using "\" that mean I am mapping your application at root context

   





Comments