tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Eggers <>
Subject Re: Trying to get 2 instances of Tomcat 6.0.x (Red Hat) to work (each having their own lib directories)...
Date Fri, 23 Sep 2011 17:00:46 GMT
----- Original Message -----

> From: Casey Burk <>
> To:
> Cc: 
> Sent: Thursday, September 22, 2011 12:33 PM
> Subject: Trying to get 2 instances of Tomcat 6.0.x (Red Hat) to work (each having their
own lib directories)...
> Hello all!
> First and foremost, forgive me if my method of delivery hasn't followed the
> normal protocol (this is my first time doing this).
> Secondly, the server I'll be deploying my web apps to is a Red Hat box with
> 2 instances of a single Tomcat 6 installation on it. These instances provide
> our team with the capabilities they need to move along the migration
> sequence during testing, but the problem is that each instance directory
> (i.e. - "/usr/tomcat/test1" and "/usr/tomcat/test2") lack 
> working "lib"
> directories with which to load jar files from. We need this.
> Is this type of capability or "segregation of class loading" managed 
> through
> the use of that CATALINA.PROPERTIES file? If so, does this imply that each
> instance directory must have one placed within their "conf" 
> directories? If
> so, what directives must be used in each?
> Here's the basic structure of our setup as it stands:
> /usr/tomcat
> /usr/tomcat/conf+lib
> /usr/tomcat/conf/catalina.
> properties
> (The lib directory at this level *IS* working.)
> /usr/tomcat/test1
> /usr/tomcat/test1/lib+conf+webapps+...
> (We need the lib directory to work.)
> /usr/tomcat/test2
> /usr/tomcat/test2/lib+conf+webapps+...
> (We need the lib directory to work.)
> The *only* truly active file we have right now in
> working order (at the time of this posting) is in / on the primary level
> inside the conf directory and it has the following uncommented lines:
> package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.,sun.beans.
> package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.
> common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar
> server.loader=
> shared.loader=
> tomcat.util.buf.StringCache.byte.enabled=true
> Do any of you have any idea how to make this work?
> Regards,
> Casey J. Burk

I'll take a stab at your question. However a few caveats are in order.

1. I run Fedora, not RedHat
2. I use Tomcat downloaded from Apache, not the distribution's version

That being said, there's a short explanation on how to do this in RUNNING.txt. Look under
the heading:

Advanced Configuration - Multiple Tomcat Instances

Normally this document is in $CATALINA_HOME. However the packaged version may have put the
document under /usr/share/doc/tomcat6 or something similar.

In general, the steps are as follows.

1. Create a copy of the original Tomcat directory structure (in $CATALINA_HOME) for each
   desired Tomcat.

2. Copy tomcat-juli.jar from $CATALINA_HOME/bin to each new directory structure's bin
   directory ($CATALINA_BASE/bin)

3. Copy all of $CATALINA_HOME/conf to $CATALINA_BASE/conf

4. Copy $CATALINA_HOME/webapps/manager to $CATALINA_BASE/webapps/manager if the manager
   application is desired

5. Make all of your configuration edits to files in $CATALINA_BASE/conf

Make any modifications to the lib directory (for example, adding JDBC drivers) to $CATALINA_BASE/lib.
Tomcat will load jars and classes from $CATALINA_BASE/lib first, then $CATALINA_HOME/lib.

To start the new Tomcats, set $CATALINA_HOME to your default Tomcat installation, $CATALINA_BASE
to your copy as set up above, and then run $CATALINA_HOME/bin/ (the file in the
original installation). Since you've set $CATALINA_BASE, paths will be set accordingly.

Here are some more notes concerning how to do this.

1. Create the copy

When you're done, the directory structure should look like this:

/usr/tomcat/test1 ($CATALINA_BASE)

(similarly for test2)

2. Copy tomcat-juli.jar to $CATALINA_BASE/bin

You may want to create a in $CATALINA_BASE/bin. This should contain all interesting
options such as JAVA_OPTS, CATALINA_OPTS, any environment variables, and JMX setup. Do not
modify $CATALINA_HOME/bin/ or $CATALINA_HOME/bin/

3. Copy all of the $CATALINA_HOME/conf files to $CATALINA_BASE/conf

You will need to edit the $CATALINA_BASE/conf files. Minimally you will need to do the following:

a. Ensure that the Server shutdown port in server.xml is unique
b. Ensure that all Connector ports in server.xml are unique

You'll probably want to enable the manager application, so make sure to edit
tomcat-users.xml appropriately.

To launch all of this, you'll need a shell script. Something like the following is quick and


# test1
sleep 5
# test2

Shutting down follows the same pattern. Just substitute for

Integrating this into /etc/rc.d, system-config-services, or systemd is left as an exercise
for the reader.

You may have some SELinux issues as well, although since your $CATALINA_BASE directories are
under $CATALINA_HOME, maybe not.

As a final note, I wouldn't recommend putting a $CATALINA_BASE installation under $CATALINA_HOME.
Depending on how the RPM update works, you may actually wipe out your $CATALINA_BASE installations.
This is speculation, since I don't use the RPM distribution of Tomcat.

. . . . just my two cents.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message