The default application of a fresh install of Tomcat 7 is ROOT. You want to remove it and use your own?
I’m running a supported Tomcat instance and it’s trial period ended. I’ll just stick with plain old Tomcat. Perhaps for a business, the enhanced Tomcat (only change is a better management console?) would make more sense. For personal use I just installed version 7. Maybe they improved the setup experience. I gave up trying to change the default web app from ROOT to my own “home”.
Nope, still makes no sense. You’d think there would be a FAQ or something on this. The kludge way is to just put your app into ROOT. Yuck. Well, its possible and easy. I found the hint here, in one of the comments.. Thanks Joe!
The trick is that you have to add a context configuration for the default web app AND you CAN’T do this with an external context file, ROOT.xml. It won’t work. Instead, add this context to the Host node in the server.xml file.
Example snippet from my conf/server.xml:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" resolveHosts="false"/>
<Context path="" docBase="home">
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->
<!-- Uncomment this to enable Comet connection tacking (provides events
on session expiration as well as webapp lifecycle) -->
<!--
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
-->
</Context>
</Host>
The diff is:
136a137,156 > <Context path="" docBase="home"> > <!-- Default set of monitored resources --> > <WatchedResource>WEB-INF/web.xml</WatchedResource> > > <!-- Uncomment this to disable session persistence across Tomcat restarts --> > <!-- > <Manager pathname="" /> > --> > <!-- Uncomment this to enable Comet connection tacking (provides events > on session expiration as well as webapp lifecycle) --> > <!-- > <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" /> > --> > > </Context>
I hope this helps.
Note, before doing the above, please verify that this information is correct. Perhaps everyone is reading the Tomcat docs incorrectly or there really is a configuration discrepancy.
Updates
12Feb2011: Funny, if you make the above change and still leave the ROOT application folder in the webapps folder, you can not open the original ROOT at http://host:port/ROOT, even if you add another context node in host. I guess I still don’t grok Tomcat config.
Links
- Copy of this post on my new blog
- How to configure Tomcat ROOT context
- The Context Container
- How to change the ROOT application
- http://octodecillion.com/blog/tomcat7-change-root-app/
Ralph Towner — Green and Golden

You can rename root app fnd access to it for example at lovalhost/ROOT1
I am using a different way:
In webapps\ROOT I create index.html that contains:
Hi,
I can’t see the content of the index.html that your’re using to force the default ROOT application in the post. Could you please resend it to me ?
thank you
Massimo
good. It saves me a lot of time.
Hi All,
I have tried adding the context in the server.xml for my application. Restarted the tomcat and now the application is not loading. Is there any other change??
Hmmm. I can get to the manager with the same url. Is it prompting for a password?
Nice tutorial, it works! However, once I have made my own app the root app. I am having problem accessing the manager app with tomcat 7.0.11
When I try to go to the url:
http://localhost:8080/manager
I get a 403 Access Denied Error.
How can I access the manager app when it is not the root?
I tried removing the CSRF filter & filter mapping in the web.xml but that didnt work.
Thanks for your help