Platinum Partner
java,apache,tomcat

Understanding Tomcat Configuration

Case #1:
When the Tomcat config is this:
<Host name="localhost" appBase="C:/apps/apache-tomcat/null"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

<Context path="/" docBase="C:/apps/apache-tomcat/DeployedApps/HelloWorld" debug="0" reloadable="false" crossContext="false"/>

Then…
http://localhost/index.jsp yields to the “index.jsp” under HelloWorld folder.
http://localhost/HelloWorld/index.jsp yields to a “404 Page”.

Case #2:
When the Tomcat setup is this:

<Host name="localhost" appBase="C:/apps/apache-tomcat/null"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

<Context path="/hw" docBase="C:/apps/apache-tomcat/DeployedApps/HelloWorld" debug="0" reloadable="false" crossContext="false"/>

Then…
http://localhost/index.jsp yields to a “blank page”.
http://localhost/HelloWorld/index.jsp yields to a “blank page”.
http://localhost/hw/index.jsp yields to the “index.jsp”.

So if the objective is to deliver “HelloWorld” as the default application for the root context, then the configuration for that instance should like “case #1”. If the objective of a particular application to be bound to a “path”=”application context”, then we need to deploy that instance as “case #2”.

I hope this clarifies the two models.

Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}