Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Restart Tomcat and you're done.BR Call up "http://myhost.company.com/" and enjoy.

Addendum 1 : If you are deploying your application as a war file..

...

Wiki Markup
For more information about this topic in general, consult this page : 
\[http://tomcat.apache.org/tomcat-6.0-doc/config/context.html The Context Container\]

Addendum 2 : If for some reason you want another method..

Wiki Markup
If, for some reason, you do not want to deploy your application under the CATALINA_BASE/webapps/ROOT subdirectory, or you do not want to name your war-file "ROOT.war", then read on.  But you should first read this :
\[http://tomcat.apache.org/tomcat-6.0-doc/config/context.html The Context Container\] and make sure you understand the implications.

The method described above is the simple method. The two methods below are more complex, and the second one has definite implications on the way you manage and run your Tomcat.

Method 2.1

  • Place your war file outside of CATALINA_BASE/webapps (it must be outside to prevent double deployment).BR
  • Place a context file named ROOT.xml in CATALINA_BASE/conf/<engine name>/<host name>. The single <Context> element in this context file MUST have a docBase attribute pointing to the location of your war file. Since you are specifying the default application, the path attribute should be "". See the Context Container above for details.

Method 2.2

If you really know what you are doing..

  • leave your war file in CATALINA_BASE/webapps, under its original nameBR
  • turn off autoDeploy and deployOnStartup in your Host element in the server.xml file.BR
  • explicitly define all application Contexts in server.xml, specifying both path and docBase. You must do this, because you have disabled all the Tomcat auto-deploy mechanisms, and Tomcat will not deploy your applications anymore unless it finds their Context in the server.xml.

Note that this last method also implies that in order to make any change to any application, you will have to stop and restart Tomcat.