How does Tomcat locate the webapps directory?

tomcat

Solution

It can be changed in the `$CATALINA_BASE/conf/server.xml` in the `<Host />` element.

<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">

See the Tomcat documentation, specifically the section in regards to the Host container:

Tomcat 6 Configuration

Tomcat 7 Configuration

Tomcat 8 Configuration

Tomcat 9 Configuration

Tomcat 10 Configuration

The default is `webapps` relative to the `$CATALINA_BASE`. An absolute pathname can be used.

Problem

How does Tomcat locate webapps directory? Where is this location set? Is it a relative directory?

Original source