You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Leo Donahue - PLANDEVX <Le...@mail.maricopa.gov> on 2010/06/15 23:38:55 UTC

Multiple Tomcat Instances

In RUNNING.txt it says you can have a single copy of Tomcat binary shared among multiple users on the same server by setting the "environment variable" $CATALINA_BASE to the directory that contains the files for each personal Tomcat instance.

As simple as that reads, I don't understand it.  I don't understand how this is different than a virtual host with different appBase's.  Is it saying that whoever has a user login on the server can have their own Tomcat playground even though there is just one Tomcat installed?

So, if on Windows, you set a User environment variable of CATALINA_BASE to something like C:\TomcatDevUser1  ... that's it?
Tomcat figures out the CATALINA_BASE variable depending on who is logged in?
Does C:\TomcatDevUser1 need a ROOT directory for their default webapp?

Leo


RE: Multiple Tomcat Instances

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Leo Donahue - PLANDEVX [mailto:LeoDonahue@mail.maricopa.gov]
> Subject: RE: Multiple Tomcat Instances
> 
> And that is the part that clears it up.  The users are starting and
> stopping Tomcat via the scripts, not the windows process.

You could install a separate Tomcat service for each user, but I don't know why you would run Tomcat as a service in a non-production (or non-quasi-production) environment.

> The other part that is confusing me is that what if all users are
> running a "process" of Tomcat at the same time, I'm assuming they all
> have to use a separate HTTP port and shutdown port?

Or unique IP addresses.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Multiple Tomcat Instances

Posted by Leo Donahue - PLANDEVX <Le...@mail.maricopa.gov>.
>From: Christopher Schultz [mailto:chris@christopherschultz.net]
>Subject: Re: Multiple Tomcat Instances
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Leo,
>
>On 6/16/2010 1:31 PM, Leo Donahue - PLANDEVX wrote:
>> Tomcat zip dir:
>> C:\ApacheTomcat\apache-tomcat-6.0.26\bin
>> In here I created a setenv.bat that has the following: set
>"CATALINA_BASE=%C:\Catalina_Base1%"
>
>That is going to be counter-productive, since any instance of Tomcat
>using CATALINA_HOME=C:\ApacheTomcat\apache-tomcat-6.0.26\bin will end up
>using CATALINA_BASE=%C:\Catalina_Base1%
>
>(BTW, %C:\Catalina_Base1% will give you the value of an environment
>variable, instead of the path C:\Catalina_Base1, right?)
>
>Instead, I might suggest using a script like
>C:\Catalina_Base1\startup.bat:
>
>@set CATALINA_BASE=C:\Catalina_Base1
>C:\ApacheTomcat\apache-tomcat-6.0.26\bin\startup.bat
>
>> C:\Catalina_Base1\conf
>> ** I copied the contents of \conf from C:\ApacheTomcat\apache-tomcat-
>6.0.26\conf
>> ** I changed the shutdown port to 8006, HTTP port to 8081, and AJP
>Port to 8010 in server.xml
>
>You can probably leave context.xml and web.xml in the original install
>without copying them. I would recommend your own server.xml (required),
>logging.properties (if you want something other than the default) and,
>if necessary, catalina.policy. Let the base Tomcat install take care of
>the other files.
>
>> Ok, so how do I get specify multiple CATALINA_BASE options in the
>setenv.bat in C:\ApacheTomcat\apache-tomcat-6.0.26\bin?
>
>You don't :) See above.
>
>Hope that helps,
>- -chris

Yes.

After this exercise, I feel like I'm learning disabled.

Re: Multiple Tomcat Instances

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Leo,

On 6/16/2010 1:31 PM, Leo Donahue - PLANDEVX wrote:
> Tomcat zip dir:
> C:\ApacheTomcat\apache-tomcat-6.0.26\bin
> In here I created a setenv.bat that has the following: set "CATALINA_BASE=%C:\Catalina_Base1%"

That is going to be counter-productive, since any instance of Tomcat
using CATALINA_HOME=C:\ApacheTomcat\apache-tomcat-6.0.26\bin will end up
using CATALINA_BASE=%C:\Catalina_Base1%

(BTW, %C:\Catalina_Base1% will give you the value of an environment
variable, instead of the path C:\Catalina_Base1, right?)

Instead, I might suggest using a script like C:\Catalina_Base1\startup.bat:

@set CATALINA_BASE=C:\Catalina_Base1
C:\ApacheTomcat\apache-tomcat-6.0.26\bin\startup.bat

> C:\Catalina_Base1\conf
> ** I copied the contents of \conf from C:\ApacheTomcat\apache-tomcat-6.0.26\conf
> ** I changed the shutdown port to 8006, HTTP port to 8081, and AJP Port to 8010 in server.xml

You can probably leave context.xml and web.xml in the original install
without copying them. I would recommend your own server.xml (required),
logging.properties (if you want something other than the default) and,
if necessary, catalina.policy. Let the base Tomcat install take care of
the other files.

> Ok, so how do I get specify multiple CATALINA_BASE options in the setenv.bat in C:\ApacheTomcat\apache-tomcat-6.0.26\bin?

You don't :) See above.

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwZX3sACgkQ9CaO5/Lv0PBS1gCcDs0cchYwsyTq+oRZBqjmBHWC
Pj0An3zcOGRfINvoGYXCnXK69RJm1wno
=yayw
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Multiple Tomcat Instances

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Leo Donahue - PLANDEVX [mailto:LeoDonahue@mail.maricopa.gov]
> Subject: RE: Multiple Tomcat Instances
> 
> http://tomcat.apache.org/tomcat-6.0-doc/introduction.html  ( If read
> the docs literally, there is no README.txt in my CATALINA_HOME )

Nor does the doc actually say there is a README.txt file in $CATALINA_HOME; that reference is there merely to explain how to interpret $CATALINA_HOME when it appears in the doc.

> I was looking in both of those, which is where I saw the call to
> setenv.bat and assumed that must be where you define it, otherwise what
> is that call for?

The setenv.bat script allows you to configure various environment variables for use by the JVM or your webapps; it's too late to set CATALINA_BASE there, since CATALINA_BASE is used to locate the setenv.bat script - as clearly stated in RUNNING.txt.  Each user should be setting CATALINA_BASE themselves - you could easily establish one for each user in the Windows equivalent of the user profile.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


RE: Multiple Tomcat Instances

Posted by Leo Donahue - PLANDEVX <Le...@mail.maricopa.gov>.
>From: André Warnier [mailto:aw@ice-sa.com]
>Subject: Re: Multiple Tomcat Instances
>
>No wonder.
>I am starting to think that you do this on purpose..

Unfortunately, I'm not.  

Everyone always says "read the docs".

There are a lot of things I don’t understand, and other than the docs mentioning there is a CATALINA_BASE variable, they don't speak to where it can/should be defined (startup.bat or catalina.bat or setenv.bat), or setting it up the way you mentioned, or that you can even do it that way.  

http://tomcat.apache.org/tomcat-6.0-doc/introduction.html  ( If read the docs literally, there is no README.txt in my CATALINA_HOME )  This is where people get lost/confused.

Much of Tomcat config is like "learning the secret handshake" to me at this point.

>Maybe having a good look at the startup.bat and catalina.bat files would help.

I was looking in both of those, which is where I saw the call to setenv.bat and assumed that must be where you define it, otherwise what is that call for?

Re: Multiple Tomcat Instances

Posted by André Warnier <aw...@ice-sa.com>.
Leo Donahue - PLANDEVX wrote:
> 
> Tomcat zip dir:
> C:\ApacheTomcat\apache-tomcat-6.0.26\bin
> In here I created a setenv.bat that has the following: set "CATALINA_BASE=%C:\Catalina_Base1%"
> 
> C:\Catalina_Base1\
> ** \conf
> ** \logs	(automatically added when I ran C:\ApacheTomcat\apache-tomcat-6.0.26\bin\startup.bat)
> ** \webapps
> ** \work	(automatically added when I ran C:\ApacheTomcat\apache-tomcat-6.0.26\bin\startup.bat)
> 
> C:\Catalina_Base1\conf
> ** I copied the contents of \conf from C:\ApacheTomcat\apache-tomcat-6.0.26\conf
> ** I changed the shutdown port to 8006, HTTP port to 8081, and AJP Port to 8010 in server.xml
> 
> C:\Catalina_Base1\webapps\ROOT  
> ** I edited the index.html to indicate I'm using the html file from Catalina_Base1
> 
> http://localhost:8081  
> produces the edited index.html file from C:\Catalina_Base1\webapps\ROOT  Very cool by the way.
> 
> Ok, so how do I get specify multiple CATALINA_BASE options in the setenv.bat in C:\ApacheTomcat\apache-tomcat-6.0.26\bin ?
> 
> This doesn't work:  set "CATALINA_BASE=%C:\Catalina_Base1%;%C:\Catalina_Base2%;%C:\Catalina_Base3%"

No wonder.
I am starting to think that you do this on purpose..

Maybe having a good look at the startup.bat and catalina.bat files would help.
It looks like setting CATALINA_BASE in setenv.bat is too late, so I would
suggest as follows :

1) at the system level, define a "system variable"
CATALINA_HOME = C:\ApacheTomcat\apache-tomcat-6.0.26
Do NOT define CATALINA_BASE there.
Do NOT define CATALINA_BASE in C:\ApacheTomcat\apache-tomcat-6.0.26\bin\setenv.bat
2) create
- c:\catalina_base1
- c:\catalina_base2
etc.. (as many as you want instances)
- under each. create \bin and \conf and \webapps
- copy the files from C:\ApacheTomcat\apache-tomcat-6.0.26\conf to each \conf and modify 
ports as required
- install under the various \webapps whichever applications you want to run in that instance
3) in one of the new \bin dirs, create a duplicate of the main startup.bat, shutdown.bat 
and setenv.bat
4) modify the new startup.bat.
Just before this line :

rem Guess CATALINA_HOME if not defined

insert these 15 lines :

rem modified LD 2010/06/16
rem upon great and free suggestion of tomcat-users list
rem to set CATALINA_BASE to this specific instance
set "CATALINA_BASE=%cd%"
if exist "%CATALINA_BASE%\conf" goto okBase
cd ..
set "CATALINA_BASE=%cd%"
if exist "%CATALINA_BASE%\conf" goto okBase
echo The CATALINA_BASE environment variable could not be set correctly
echo This environment variable is needed to run this program
goto end

:okBase
cd "%CATALINA_BASE%\bin"

and save the file.

5) do similarly for shutdown.bat (just to be neat and consistent)
6) copy these new startup.bat, shutdown.bat, setenv.bat to each
of your new \bin directories.
6) now open a command window, do a cd to one of your c:\catalina_base1,2,3\bin 
directories, type "startup.bat" and enjoy.
Repeat for the other instances.

Report here if that does not work, cause I don't feel like testing it right now.






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Multiple Tomcat Instances

Posted by Leo Donahue - PLANDEVX <Le...@mail.maricopa.gov>.
>-----Original Message-----
>From: Christopher Schultz [mailto:chris@christopherschultz.net]
>Subject: Re: Multiple Tomcat Instances
>
>Leo,
>
>
>No, you don't have to have one, but if it's there, Tomcat will prefer
>the more-specific library(ies) found in CATALINA_BASE/lib to those found
>in CATALINA_HOME/lib.
>
>> If I place copies(?) of bin, conf, logs, webapps, work and temp in my
>> $CATALINA_BASE directory, then how is that different from just
>> downloading multiple Tomcat zip files and naming them separately,
>> changing the startup/shutdown ports on each?
>
>If you copy everything, then there is no difference. It's more typical
>to only create conf/server.xml and a separate webapps directory for the
>separate instance. The 'work' and 'temp' directories (and "logs"? I
>haven't checked) will automatically be created for you. Run the scripts
>from CATALINA_HOME and they will use CATALINA_BASE to figure everything
>out.
>
>Something not yet mentioned that can be done when using CATALINA_BASE is
>that you can have separate versions of the JVM running the same version
>of Tomcat, if that's useful to you. For instance, in production, we run
>4 separate JVMs - one for each of our primary web applications. Some of
>those applications haven't yet been tested extensively under Java 6,
>yet, so we run them on Java 5 instead.
>
>> The only thing I'm gaining is only needing the two files in my
>> $CATALINA_BASE/bin instead of all the other files? What else? What was
>> the deciding factor to be able to run multiple Tomcat instances?
>
>If you use a minimal set of files in CATALINA_BASE, then upgrading
>multiple (separate) installations of Tomcat is easily done by simply
>installing a new version of Tomcat into a new directory and running the
>new startup script. You can even switch-back to the old version fairly
>easily: run the startup script from the old version instead. ;)
>
>- -chris

This is very helpful everyone.  This kind of stuff needs to be in a newsletter or something, the part about using multiple jvms, and typical setups etc.


Tomcat zip dir:
C:\ApacheTomcat\apache-tomcat-6.0.26\bin
In here I created a setenv.bat that has the following: set "CATALINA_BASE=%C:\Catalina_Base1%"

C:\Catalina_Base1\
** \conf
** \logs	(automatically added when I ran C:\ApacheTomcat\apache-tomcat-6.0.26\bin\startup.bat)
** \webapps
** \work	(automatically added when I ran C:\ApacheTomcat\apache-tomcat-6.0.26\bin\startup.bat)

C:\Catalina_Base1\conf
** I copied the contents of \conf from C:\ApacheTomcat\apache-tomcat-6.0.26\conf
** I changed the shutdown port to 8006, HTTP port to 8081, and AJP Port to 8010 in server.xml

C:\Catalina_Base1\webapps\ROOT  
** I edited the index.html to indicate I'm using the html file from Catalina_Base1

http://localhost:8081  
produces the edited index.html file from C:\Catalina_Base1\webapps\ROOT  Very cool by the way.

Ok, so how do I get specify multiple CATALINA_BASE options in the setenv.bat in C:\ApacheTomcat\apache-tomcat-6.0.26\bin ?

This doesn't work:  set "CATALINA_BASE=%C:\Catalina_Base1%;%C:\Catalina_Base2%;%C:\Catalina_Base3%"

Re: Multiple Tomcat Instances

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Leo,

On 6/16/2010 11:36 AM, Leo Donahue - PLANDEVX wrote:
>>> From: André Warnier [mailto:aw@ice-sa.com]
>>> Subject: Re: Multiple Tomcat Instances
>>>
>>> The other part that is confusing me is that what if all users are
>>> running a "process" of Tomcat at the same time, I'm assuming they all
>>> have to use a separate HTTP port and shutdown port?
>>>>
>>> You are not confused here. That is correct.
>>> If you have several Tomcat /instances/ (actually, they will be instances of java, running Tomcat),
>>> not two of them can open the same server port at the same time.
>>> If you are running one single instance of Tomcat (of java running Tomcat) with several
>>> "virtual hosts" defined in it, then there is only a single shutdown
>>> port, and there /can/ be a single HTTP port shared by all virtual hosts (or, just to add some
>>> confusion, there can also be several ports :-)).
> 
> RUNNING.txt says:  
> "... Note that by default Tomcat will first try to load classes and JARs from
> $CATALINA_BASE/lib and then $CATALINA_HOME/lib. You can place instance specific
> JARs and classes (e.g. JDBC drivers) in $CATALINA_BASE/lib whilst keeping the
> standard Tomcat JARs in $CATALINA_HOME/lib  ..."
> 
> The doc didn't mention that Tomcat will calculate a "relative"
> reference for files in /lib, a few lines above this quote.  I'm
> assuming I also need a /lib directory in $CATALINA_BASE then.

No, you don't have to have one, but if it's there, Tomcat will prefer
the more-specific library(ies) found in CATALINA_BASE/lib to those found
in CATALINA_HOME/lib.

> If I place copies(?) of bin, conf, logs, webapps, work and temp in my
> $CATALINA_BASE directory, then how is that different from just 
> downloading multiple Tomcat zip files and naming them separately, 
> changing the startup/shutdown ports on each?

If you copy everything, then there is no difference. It's more typical
to only create conf/server.xml and a separate webapps directory for the
separate instance. The 'work' and 'temp' directories (and "logs"? I
haven't checked) will automatically be created for you. Run the scripts
from CATALINA_HOME and they will use CATALINA_BASE to figure everything out.

Something not yet mentioned that can be done when using CATALINA_BASE is
that you can have separate versions of the JVM running the same version
of Tomcat, if that's useful to you. For instance, in production, we run
4 separate JVMs - one for each of our primary web applications. Some of
those applications haven't yet been tested extensively under Java 6,
yet, so we run them on Java 5 instead.

> The only thing I'm gaining is only needing the two files in my
> $CATALINA_BASE/bin instead of all the other files? What else? What was
> the deciding factor to be able to run multiple Tomcat instances?

If you use a minimal set of files in CATALINA_BASE, then upgrading
multiple (separate) installations of Tomcat is easily done by simply
installing a new version of Tomcat into a new directory and running the
new startup script. You can even switch-back to the old version fairly
easily: run the startup script from the old version instead. ;)

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwY94cACgkQ9CaO5/Lv0PAaDQCfZxvkggZwz5RFc03vTtd0Oyfp
8AwAnRMMMRLtx7pEeDeveKLBbJCK05p6
=yoAx
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Multiple Tomcat Instances

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Leo Donahue - PLANDEVX [mailto:LeoDonahue@mail.maricopa.gov]
> Subject: RE: Multiple Tomcat Instances
> 
> The doc didn't mention that Tomcat will calculate a "relative"
> reference for files in /lib, a few lines above this quote.

Correct, because Tomcat doesn't.  $CATALINA_BASE/lib is searched before $CATALINA_HOME/lib, that's all.

> I'm assuming I also need a /lib directory in $CATALINA_BASE then.

No, you only need a $CATALINA_BASE/lib if you want to have an instance-specific jar or class in there, rather than using the common ones in $CATALINA_HOME/lib.

> If I place copies(?) of bin, conf, logs, webapps, work and temp in my
> $CATALINA_BASE directory, then how is that different from just
> downloading multiple Tomcat zip files and naming them separately,
> changing the startup/shutdown ports on each?

It's not, so don't do that.

> The only thing I'm gaining is only needing the two files in my
> $CATALINA_BASE/bin  instead of all the other files?

That and not needing copies of the 16 or so jars in the lib directory.

> What was the deciding factor to be able to run multiple Tomcat 
> instances?

It's simply another option available to you.  You have to decide if it's useful or not in your situation.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Multiple Tomcat Instances

Posted by Leo Donahue - PLANDEVX <Le...@mail.maricopa.gov>.
>>From: André Warnier [mailto:aw@ice-sa.com]
>>Subject: Re: Multiple Tomcat Instances
>>
>> The other part that is confusing me is that what if all users are
>>running a "process" of Tomcat at the same time, I'm assuming they all
>>have to use a separate HTTP port and shutdown port?
>>>
>>You are not confused here. That is correct.
>>If you have several Tomcat /instances/ (actually, they will be instances of java, running Tomcat),
>> not two of them can open the same server port at the same time.
>>If you are running one single instance of Tomcat (of java running Tomcat) with several
>>"virtual hosts" defined in it, then there is only a single shutdown
>>port, and there /can/ be a single HTTP port shared by all virtual hosts (or, just to add some
>>confusion, there can also be several ports :-)).

RUNNING.txt says:  
"... Note that by default Tomcat will first try to load classes and JARs from
$CATALINA_BASE/lib and then $CATALINA_HOME/lib. You can place instance specific
JARs and classes (e.g. JDBC drivers) in $CATALINA_BASE/lib whilst keeping the
standard Tomcat JARs in $CATALINA_HOME/lib  ..."

The doc didn't mention that Tomcat will calculate a "relative" reference for files in /lib, a few lines above this quote.  I'm assuming I also need a /lib directory in $CATALINA_BASE then.

If I place copies(?) of bin, conf, logs, webapps, work and temp in my $CATALINA_BASE directory, then how is that different from just downloading multiple Tomcat zip files and naming them separately, changing the startup/shutdown ports on each?

The only thing I'm gaining is only needing the two files in my $CATALINA_BASE/bin  instead of all the other files?  What else?  What was the deciding factor to be able to run multiple Tomcat instances?

Leo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Multiple Tomcat Instances

Posted by André Warnier <aw...@ice-sa.com>.
Leo Donahue - PLANDEVX wrote:
>>> From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
>>> Subject: RE: Multiple Tomcat Instances
>>>
>>> Read the rest of that section of RUNNING.txt as well:
>>>
>>> "When you use $CATALINA_BASE, Tomcat will calculate all relative
>>> references for files in the following directories based on the value of $CATALINA_BASE instead of $CATALINA_HOME:
>>> * bin  - Only setenv.sh (*nix), setenv.bat (windows) and tomcat-juli.jar
>>> * conf - Server configuration files (including server.xml)
>>> * logs - Log and output files
>>> * webapps - Automatically loaded web applications
>>> * work - Temporary working directories for web applications
>>> * temp - Directory used by the JVM for temporary files (java.io.tmpdir)"
> 
> I saw this part but was confused about the word "relative" and thought it meant that somehow Tomcat would still be using a relative reference to the original directories based on where the $CATALINA_BASE directory was created.
> 
>>> You seem to be confusing installation directories with running processes;
> 
> I am.
> 
>>> Tomcat uses whatever CATALINA_BASE is active when Tomcat is run via
>>> the startup.bat or catalina.bat scripts.  Since each user has complete
>>> control over his/her environment variables, he or she can set the variable to any value desired.
> 
> And that is the part that clears it up.  The users are starting and stopping Tomcat via the scripts, not the windows process.  
> 
> The other part that is confusing me is that what if all users are running a "process" of Tomcat at the same time, I'm assuming they all have to use a separate HTTP port and shutdown port?
> 
You are not confused here. That is correct.
If you have several Tomcat /instances/ (actually, they will be instances of java, running 
Tomcat), not two of them can open the same server port at the same time.
If you are running one single instance of Tomcat (of java running Tomcat) with several 
"virtual hosts" defined in it, then there is only a single shutdown port, and there /can/ 
be a single HTTP port shared by all virtual hosts (or, just to add some confusion, there 
can also be several ports :-)).

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Multiple Tomcat Instances

Posted by Leo Donahue - PLANDEVX <Le...@mail.maricopa.gov>.
>>From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
>>Subject: RE: Multiple Tomcat Instances
>>
>>Read the rest of that section of RUNNING.txt as well:
>>
>>"When you use $CATALINA_BASE, Tomcat will calculate all relative
>>references for files in the following directories based on the value of $CATALINA_BASE instead of $CATALINA_HOME:
>>* bin  - Only setenv.sh (*nix), setenv.bat (windows) and tomcat-juli.jar
>>* conf - Server configuration files (including server.xml)
>>* logs - Log and output files
>>* webapps - Automatically loaded web applications
>>* work - Temporary working directories for web applications
>>* temp - Directory used by the JVM for temporary files (java.io.tmpdir)"

I saw this part but was confused about the word "relative" and thought it meant that somehow Tomcat would still be using a relative reference to the original directories based on where the $CATALINA_BASE directory was created.

>>You seem to be confusing installation directories with running processes;

I am.

>>Tomcat uses whatever CATALINA_BASE is active when Tomcat is run via
>>the startup.bat or catalina.bat scripts.  Since each user has complete
>>control over his/her environment variables, he or she can set the variable to any value desired.

And that is the part that clears it up.  The users are starting and stopping Tomcat via the scripts, not the windows process.  

The other part that is confusing me is that what if all users are running a "process" of Tomcat at the same time, I'm assuming they all have to use a separate HTTP port and shutdown port?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Multiple Tomcat Instances

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Leo Donahue - PLANDEVX [mailto:LeoDonahue@mail.maricopa.gov]
> Subject: Multiple Tomcat Instances
> 
> As simple as that reads, I don't understand it.

Read the rest of that section of RUNNING.txt as well:

"When you use $CATALINA_BASE, Tomcat will calculate all relative references for
files in the following directories based on the value of $CATALINA_BASE instead
of $CATALINA_HOME:
* bin  - Only setenv.sh (*nix), setenv.bat (windows) and tomcat-juli.jar
* conf - Server configuration files (including server.xml)
* logs - Log and output files
* webapps - Automatically loaded web applications
* work - Temporary working directories for web applications
* temp - Directory used by the JVM for temporary files (java.io.tmpdir)"

> I don't understand how this is different than a virtual host with 
> different appBase's.

Because in the multiple Tomcat instances scenario, each user gets a separate instance (hence the name), which he or she may start, stop, crash, hang in a loop, or otherwise manipulate without any impact to the other Tomcat instances.  When using multiple <Host> elements, everyone is using the *same* Tomcat instance, so when one user messes up, all suffer.

> Is it saying that whoever has a user login on the server 
> can have their own Tomcat playground even though there is
> just one Tomcat installed?

It has nothing to do with user logins, just the individual CATALINA_BASE settings.  If you choose to tie that to a login, fine, but that's not a requirement.

You seem to be confusing installation directories with running processes; do you think that because there's only one Notepad installed, you can only run one at a time?

> So, if on Windows, you set a User environment variable of 
> CATALINA_BASE to something like C:\TomcatDevUser1  ... 
> that's it?

No, you have to set up the files under that directory as described in RUNNING.txt.

> Tomcat figures out the CATALINA_BASE variable depending 
> on who is logged in?

No, Tomcat uses whatever CATALINA_BASE is active when Tomcat is run via the startup.bat or catalina.bat scripts.  Since each user has complete control over his/her environment variables, he or she can set the variable to any value desired.

> Does C:\TomcatDevUser1 need a ROOT directory for their default webapp?

Yes.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org