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 <do...@mail.maricopa.gov> on 2009/03/18 21:38:44 UTC

Tomcat 5.0.28 and 6.0.18 on same server

I'd like to run two different versions of Tomcat on the same server if poss= ible.

I have Tomcat 5.0.28 running as a windows service from a non-zipped version= download. I'd like to be able to run Tomcat 6.0 on the same server.

I'm not trying to setup a test and development environment, I actually have= to support an webapp that requires Tomcat 5.0.28 but I would also like to = run a webapp that supports JSF 1.2

Some of the articles I've read offer different approaches to doing this. S= ome articles talk about editing the service.bat file, some articles talk ab= out just changing the start and shutdown ports between the two versions.

Can someone point me in the right direction to accomplish this?


Leo

RE: Tomcat 5.0.28 and 6.0.18 on same server

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: André Warnier [mailto:aw@ice-sa.com] 
> Subject: Re: Tomcat 5.0.28 and 6.0.18 on same server
> 
> > The tomcat.exe was not found...
> > The CATALINA_HOME environment variable is not defined correctly.
> > This environment variable is needed to run this program

You do not (and should not) set the CATALINA_HOME environment variable.  Run the service.bat script from a command prompt, with the current directory set to Tomcat's bin directory.  The script will find the executable.

> > Since the setup docs for version 5.0.28 make no 
> > reference to setting this CATALINA_HOME environment
> > variable, I deleted it.

Good; you should not have it set explicityly.

> The logical thing, I guess, would be to define two different users on 
> your system, each with its own set of variables, and run each Tomcat 
> under a different user, allowing each user to have its own 
> CATALINA_HOME.

No, no, no.  Don't set CATALINA_HOME at all.  The scripts will use the proper directories when you run them from a command prompt and have current directory set properly.  The Tomcat service does not utilize any environment variables, of course.

 - 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: Tomcat 5.0.28 and 6.0.18 on same server

Posted by André Warnier <aw...@ice-sa.com>.
Leo Donahue - PLANDEVX wrote:
> You guys are good 
We're trying our best, modestly.
...
  > Thank you very much for your help.  Much appreciated.
No problem, we like to show off.
...
> 
> I did have one problem when I issued the "service" command.  It gave me the reply:
> 
> The tomcat.exe was not found...
> The CATALINA_HOME environment variable is not defined correctly.
> This environment variable is needed to run this program
> 
> I checked the environment variables on the "Advanced" tab of system properties and the CATALINA_HOME variable was pointing to the install_dir for the Tomcat5028 version.  Since the setup docs for version 5.0.28 make no reference to setting this CATALINA_HOME environment variable, I deleted it.  That might have been a bad idea, however both Tomcats are working fine.  I don't know if the original third part app set that environment variable for some reason or if it was a relic from a previous install of something.
> 

Yep, I forgot about that one.
It was probably set by your first install.
CATALINA_HOME should be set to the base of your Tomcat installation (the 
directory in which you installed the software, and which contains the 
conf, bin, webapps etc.. subdirectories).
(CATALINA_BASE is used when you have multiple instances of the same 
Tomcat version running. If you have a single instance, it is equivalent 
to CATALINA_HOME.)

In your case however, it's a bit iffy, since you are under Windows, 
where there is only one global CATALINA_HOME variable, but you have two 
different code bases running.

The logical thing, I guess, would be to define two different users on 
your system, each with its own set of variables, and run each Tomcat 
under a different user, allowing each user to have its own CATALINA_HOME.

I don't know exactly what, apart from the startup scripts that you will 
find in the "conf" subdirectory of each Tomcat, may reference this 
CATALINA_HOME.
But since you are running both Tomcats as services, they do not use 
those scripts anyway.

Which is probably why nothing bad happened when you deleted the variable.

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


RE: Tomcat 5.0.28 and 6.0.18 on same server

Posted by Leo Donahue - PLANDEVX <do...@mail.maricopa.gov>.
You guys are good and for that I am thankful.  I wasn't trying to be pointed, I just didn't know.

Since Tomcat5028 was already running as a service, I downloaded the zip file for Tomcat6018 as suggested.  I edited the server.xml file and changed the Shutdown port to 8006 and the http port to 8081.

I ran the command:  service install Tomcat6018 
which installed Tomcat as a windows service with the name "Apache Tomcat Tomcat6018".  I suppose I should have just gave it the version number, I can change that.

Thank you very much for your help.  Much appreciated.

I did have one problem when I issued the "service" command.  It gave me the reply:

The tomcat.exe was not found...
The CATALINA_HOME environment variable is not defined correctly.
This environment variable is needed to run this program

I checked the environment variables on the "Advanced" tab of system properties and the CATALINA_HOME variable was pointing to the install_dir for the Tomcat5028 version.  Since the setup docs for version 5.0.28 make no reference to setting this CATALINA_HOME environment variable, I deleted it.  That might have been a bad idea, however both Tomcats are working fine.  I don't know if the original third part app set that environment variable for some reason or if it was a relic from a previous install of something.

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: Wednesday, March 18, 2009 2:47 PM
To: Tomcat Users List
Subject: Re: Tomcat 5.0.28 and 6.0.18 on same server

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

André,

On 3/18/2009 5:09 PM, André Warnier wrote:
> 1) you cannot run two http servers listening on the same port(s), on 
> the same host.

Just to be clear, you /can/ bind to the same port more than once on the same host if you have multiple IPs: you can bind to different IP addresses using the same port. Presumably, your DNS records won't point to two IPs that do different things, though.

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

iEYEARECAAYFAknBa7YACgkQ9CaO5/Lv0PASzQCfXrcAiNPUQQJ0aC4Hun8w/96g
K24An1+yna/ITMSXDjikc8/413Oj/1My
=qKdO
-----END PGP SIGNATURE-----

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


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


Re: Tomcat 5.0.28 and 6.0.18 on same server

Posted by André Warnier <aw...@ice-sa.com>.
Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> André,
> 
> On 3/18/2009 5:09 PM, André Warnier wrote:
>> 1) you cannot run two http servers listening on the same port(s), on the
>> same host.
> 
> Just to be clear, you /can/ bind to the same port more than once on the
> same host if you have multiple IPs: you can bind to different IP
> addresses using the same port. Presumably, your DNS records won't point
> to two IPs that do different things, though.
> 
My, you're in a nitpicking mood today.
First, URL-encoded HTTP header values, now this..

OP, just for the sake of absolute correctness, Chris is right. 
Remember, for the future, that you /could/ give your host two different 
IP addresses, and two different corresponding DNS hostnames, and that 
this would allow you to run two different Tomcats listening on the same 
ports on the same physical host.
You could also of course install an Apache httpd in front of your 
Tomcats, and through the judicious use of connectors and/or proxying and 
URL rewriting rules, even manage to have the two different Tomcats 
/appear/ to respond on the very same port and IP address, while in 
reality they wouldn't.

But since by now you already have two proposed setups, one based on the 
zip version and the other on the exe installer, let's keep things simple 
and practical for now, shall we ?


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


Re: Tomcat 5.0.28 and 6.0.18 on same server

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

André,

On 3/18/2009 5:09 PM, André Warnier wrote:
> 1) you cannot run two http servers listening on the same port(s), on the
> same host.

Just to be clear, you /can/ bind to the same port more than once on the
same host if you have multiple IPs: you can bind to different IP
addresses using the same port. Presumably, your DNS records won't point
to two IPs that do different things, though.

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

iEYEARECAAYFAknBa7YACgkQ9CaO5/Lv0PASzQCfXrcAiNPUQQJ0aC4Hun8w/96g
K24An1+yna/ITMSXDjikc8/413Oj/1My
=qKdO
-----END PGP SIGNATURE-----

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


Re: Tomcat 5.0.28 and 6.0.18 on same server

Posted by André Warnier <aw...@ice-sa.com>.
Leo Donahue - PLANDEVX wrote:
> I'd like to run two different versions of Tomcat on the same server if poss= ible.
> 
> I have Tomcat 5.0.28 running as a windows service from a non-zipped version= download. I'd like to be able to run Tomcat 6.0 on the same server.
> 
> I'm not trying to setup a test and development environment, I actually have= to support an webapp that requires Tomcat 5.0.28 but I would also like to = run a webapp that supports JSF 1.2
> 
> Some of the articles I've read offer different approaches to doing this. S= ome articles talk about editing the service.bat file, some articles talk ab= out just changing the start and shutdown ports between the two versions.
> 
> Can someone point me in the right direction to accomplish this?
> 
Allright, I'll bite.  And probably forget something along the way.  But 
you ask just to be pointed, right ?

1) you cannot run two http servers listening on the same port(s), on the 
same host.  So, no matter what you do, you are going to have to change 
the ports on which your second Tomcat will listen.
That means that the users of one Tomcat will access it like
http://yourserver:8080
and the users of the other Tomcat, like
http://yourserver:8081

If you really don't like that, it is also possible to avoid it, but it 
is more complicated and we'll leave that for a second phase.

To find out which ports the first Tomcat is listening on, look at the 
file "server.xml" which should be in the "conf" subdirectory of your 
first Tomcat. In that file, you will find at least two uncommented 
<Connector> sections, each having a "port=" attribute.
Note these port numbers.

If this Tomcat is currently running, open a command window and enter
netstat -an | more
and look for lines ending in "LISTEN".  Each such line indicates that 
there is some program listening on a port, and two of them should match 
your <Connector>'s ports above (look in the second column, for something 
like
127.0.0.1:8080
where the last part is the port number.

Yes ? then we're doing well.
Those are the ports to avoid with your second Tomcat.

2) you can also not run two Windows services with exactly the same name.
So you might have to change the service's name for the second Tomcat.

Other than that, there should not be big difficulties.

Download and install your second Tomcat in a different directory from 
the first one.
If you are using the non-zipped version, I guess this means the 
installer, and that means I have to do some guesswork from memory.
The second Tomcat will probably install properly, but it will not start, 
because of the ports conflict.
If so, find the server.xml of the second Tomcat, and change the ports in 
the <Connector> elements, to be different from the first Tomcat.
For example
8005 --> 8006
8080 --> 8081

Then try to start this Tomcat, and let us know what happens.



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


RE: Tomcat 5.0.28 and 6.0.18 on same server

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Leo Donahue - PLANDEVX [mailto:donahuel@mail.maricopa.gov] 
> Subject: Tomcat 5.0.28 and 6.0.18 on same server
> 
> I have Tomcat 5.0.28 running as a windows service from a 
> non-zipped version= download. I'd like to be able to run 
> Tomcat 6.0 on the same server.

Use the 6.0 zip download for this purpose.

> Some articles talk about editing the service.bat file

Whoever authored that is someone to avoid.

> some articles talk about just changing the start 
> and shutdown ports between the two versions.

That's one of the correct ways to do it.  You could also run separate IP addresses for the two Tomcats, if your environment allows that.

Look in the server.xml files; you'll see port numbers on the <Server> and <Connector> elements, and you may see IP addresses on <Connector>.  The shutdown port (normally 8005) must be unique, since it's used only on the fixed address 127.0.0.1.  If there are any <Connector> elements you don't need (e.g., AJP), comment them out to make your job easier.  The <Connector> elements left are the ones you'll need to make unique, either by IP address or port number.

To install Tomcat 6.0 as a service, simply supply a unique name (e.g., Tomcat6) for the service.bat script:
  service install Tomcat6

 - 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