Configuring Your Contexts

General

Contexts are normally located underneath the appBase directory. For example, to deploy the foobar context as a war file in the ren host, use $CATALINA_HOME/renapps/foobar.war. Note that the default or ROOT context forren would be deployed as $CATALINA_HOME/renapps/ROOT.war (WAR) or $CATALINA_HOME/renapps/ROOT(directory).

 

NOTE: The docBase for a context should never be the same as the appBase for a host.

context.xml – approach #1

Within your Context, create a META-INF directory and then place your Context definition in it in a file namedcontext.xml. i.e. $CATALINA_HOME/renapps/ROOT/META-INF/context.xml This makes deployment easier, particularly if you’re distributing a WAR file.

 

context.xml – approach #2

Create a structure under $CATALINA_HOME/conf/Catalina corresponding to your virtual hosts, e.g.:

 

mkdir $CATALINA_HOME/conf/Catalina/ren

mkdir $CATALINA_HOME/conf/Catalina/stimpy

 

Note that the ending directory name “Catalina” represents the name attribute of the Engine element as shown above.

 

Now, for your default webapps, add:

 

$CATALINA_HOME/conf/Catalina/ren/ROOT.xml

$CATALINA_HOME/conf/Catalina/stimpy/ROOT.xml

 

If you want to use the Tomcat manager webapp for each host, you’ll also need to add it here:

 

cd $CATALINA_HOME/conf/Catalina

cp localhost/manager.xml ren/

cp localhost/manager.xml stimpy/

Further Information

Consult the configuration documentation for other attributes of the Context element.

Get industry recognized certification – Contact us

Menu