rogerl
rogerl

Reputation: 207

Default application in Tomcat

Newbie question.

I installed Tomcat on my Ubuntu box and have it working, but I am having trouble understanding the docBase context (and, I guess, what contexts in general refer to).

I am using a different CATALINA_BASE = ~/dev/tomcat, with my webapps directory etc underneath that. I placed the line

<Context path="" docBase="/home/.../tomcat/webapps"/>

in the server.xml file; I think this is what tells Tomcat where to look for its directories. But the tutorial I am reading implies (nay, it says) that I should place the line

<Context path="" docBase="/home/.../tomcat/webapps/ROOT"/>

in the server.xml file.

Is that correct? If so, what do these two lines do? (If there is a piece of documentation somewhere that clearly explains all of this, please just refer me to it, but I can't find one - the key word being clear).

Upvotes: 2

Views: 1290

Answers (1)

poussma
poussma

Reputation: 7321

A context is more or less a "webapp context". It describes what is deploy and where / how to access it. The docBase is the location of the war, and the path the endpoint url.

It MUST be unique on a server.

Usually ROOT is deploy on myserver:8080/ (path= "") and mywebapp on myserver:8080/uhuh (path = "uhuh")

By default, if you don't specify a path tomcat deploys the application and set the path to the war name.

The Context directives are in the Host directive to override the default behaviour. The Host has the appBase attribute. This attribute declares where to find additional war to deploy. Normally, they are automatically deployed on tc start up with default settings.

HIH

Upvotes: 2

Related Questions