Understanding Tomcat Configuration | MyThinkPond

Case #1: When the Tomcat config is this: [sourcecode language=“jscript”]

[/sourcecode]

Observe the “path” element in the “Context”. 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: [sourcecode language=“jscript”]

[/sourcecode]

Once again observe the “path” element in the “Context”. 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. Also note that in either one of these cases, I have modified the “Host” parameter’s “appBase” to point to a non-default folder (Default folder is “webapps” under TOMCAT_HOME. Depending upon the download you fetch, you may have additional applications such as the Tomcat manager and ROOT deployed by default each and every time. You do not need them unless you are using the Tomcat manager for your deployment. So in this example, I have move the “appBase” to point to an empty folder location.

Venkatt Guhesan avatar
About Venkatt Guhesan
Enterprise Software Architect currently working at DataDirect Networks developing a highly scalable monitoring solution called DDN Insight. My passions include all things Open Source including Linux (CentOS, Red Hat, Gentoo, Open Stack, Docker & Ubuntu), embedded ARM processors and microcontrollers (Arduino, UDOO, Cubieboard, BeagleBoard, OnionIO, TI's Zigbee). Coming from an Electrical and Computer Engineering background, working in developing and designing enterprise - distributed, highly scalable software requires a unique set of software skills with a good understanding of the hardware. This makes his work challenging and interesting. In his free time, he spends his time with his family and two children. He also enjoys researching on topics including - world ancient history and yoga. Visit the 'About' section for more details.
comments powered by Disqus