Tomcat: Defining a Context, what are [Enginename] and [Hostname]?

Viewed 2456

In the documentation of Tomcat, the section about Defining a context lists the following options to define a context:

  1. In an individual file at /META-INF/context.xml inside the application files.
  2. In individual files (with a ".xml" extension) in the $CATALINA_BASE/conf/[enginename]/[hostname]/ directory. The context path and version will be derived from the base name of the file (the file name less the .xml extension). This file will always take precedence over any context.xml file packaged in the web application's META-INF directory.
  3. Inside a Host element in the main conf/server.xml.

Option 1 is bad, because it means that one must hard code the values inside the application artifact and they cannot be easily changed.

Option 3 is actively discouraged by the documentation:

It is NOT recommended to place elements directly in the server.xml file.

This only leaves us with option 2, especially this is the only option if we would like to deploy the same application several times with different configurations (e.g. one for production, one for testing).

However the documentation does not explain, what [enginename] or [hostname] are supposed to be, or what they default to.

What are the default values for these and where can I change them?

1 Answers
Related