tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: Tomcat
Date Wed, 06 Feb 2013 10:51:01 GMT wrote:
> Hi
> Regrets for the wrong framing of question.
> Actually I am new to tomcat and what I really want to do is run on the same server two
different tomcats so that one doesn't interfere with the working of the other.
> As I have different environments so I want that the tomcat running in my development
environment do not access the files of my SIT environment and vice-versa. That's why I want
to have a separate tomcat process for each host.
> If I just change the port in the config file the request will be mapped but the various
environments will have access to all the files as it will be present in the common directory.

Ah, that's better.
So we forget about Apache httpd, right ?
So, assuming that you are talking about tomcat only :

There are (many) different levels of separation, depending on what you really want to 

First, a note : considering that you are on a Linux machine, it is highly possible that 
you have installed Tomcat using a pre-packaged version from your Linux distribution.
These packages work fine and are easy to install for a normal single-instance case, but 
they make it more difficult for doing the kind of thing that you want to do, and more 
difficult for people on this list to help you.  That is because each of these packages 
distributes the files of Tomcat in different places on the disk, sets different 
environment variables, sets differents links from one directory to the other in the 
filesystem, etc..
So it would be better to install a "standard" tomcat downloaded from the website 
"", to some directory like /opt/tomcat, and follow the instructions that

are given in the "RUNNING.txt" file at the top of this distribution.
This way, everyone here knows what you are talking about and has a good idea of where 
things are.
(You can also leave your current Tomcat where it is, and consider it as your "production"

tomcat, and download and install another copy to another directory as your "development" 
tomcat. Then we can maybe help you set up this development tomcat in a way that does not 
conflict with the other one).

Then, the next question is : you want to run 2 "separate" tomcats, so as not to mix the 
production and the development environments. That's established.
But do you want also to be able to run 2 different /versions/ of Tomcat ?

If yes, you will have to download and install tomcat twice, to 2 separate directories in 
/opt (such as /opt/tomcat-prod and /opt/tomcat-dev for instance).
If not, then one single copy of tomcat will be enough, and you can configure things to 
still run 2 different "instances" of tomcat, from one single copy of the code.

Then, some advance information :
There are 2 environment variables which point to disk directories and which are very 
important for what you want to do :

CATALINA_HOME : this tells Tomcat where its runnable *code* is located.  under 
CATALINA_HOME, Tomcat expects to find for example it's "bin" subdirectory, where the main

executable parts of Tomcat are located.

CATALINA_BASE : this tells Tomcat where its instance-specific "things" are located. For 
example, Tomcat will look into $CATALINA_BASE/conf to find its main configuration files.

By default, these 2 values are the same, and Tomcat will use the same /bin, /conf etc..

But you can set up 2 tomcat instances to use the same $CATALINA_HOME directory (so they 
will run the same Tomcat code from $CATALINA_HOME/bin), but have different $CATALINA_BASE

directories (so they will use a different configuration from $CATALINA_BASE/conf, 
different webapps from $CATALINA_BASE/webapps etc).

That's the basics for separating two tomcat instances.

Note that there is still a much easier way, using a single Tomcat instance and just 2 
separate "virtual hosts" inside the same running Tomcat
(see :
The hostnames will be different, and the webapps will be completely separate.  But there 
will still be one single instance of tomcat running, and there /could/ be interference 
between them (not at the access level, but in the sense that one webapp could use up all 
the memory and so interfere with the other e.g.).

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

View raw message