You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Berneburg, Cris J. - US" <cb...@caci.com> on 2017/12/15 15:36:25 UTC

diff tomcat versions share the same CATALINA_BASE?

I'm thinking about upgrading our tomcat from version 6.x to 8.5.x.  Yeah, it's overdue.  :-)  In our test environment, I would like to install 8.5 in parallel with 6 for side-by-side comparison testing.

Having never done it before, I'm also thinking about splitting the tomcat and document locations with different values for CATALINA_HOME home CATALINA_BASE.  So each tomcat instance, 6 and 8, would need its own copy of CATALINA_HOME.  Running under Windows Server as a service, CATALINA_HOME would need to be somehow configured differently for each service.  I assume that can be figured out somehow.  Hints are welcome.  ;-)

My question is this.  Is it even possible or simply not recommended for both tomcat instances to share the same CATALINA_BASE?  The work folder with compiled cache is buried in CATALINA_HOME, not under webapps, right?  It also assumes that no changes need to be made to the application code or web.xml to accommodate the newer tomcat version.  If changes need to be made for the new version, then the whole issue becomes moot.

Just in case you're curious why ... I'm a developer.  :-)

--
Cris Berneburg
CACI Lead Software Engineer


Re: diff tomcat versions share the same CATALINA_BASE?

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

Cris,

On 12/18/17 11:37 AM, Berneburg, Cris J. - US wrote:
> Chris
> 
> Thanks again taking the time to help.  Please see below.
> 
>>>> So I would recommend a separate CATALINA_BASE for each
>>>> application's support for a major Tomcat version. Note that
>>>> you are welcome to share WAR files for an application.
>>>> 
>>>> Example:
>>>> 
>>>> Tomcat 6 CATALINA_BASE: bin/setenv.sh conf/server.xml 
>>>> conf/context.xml conf/web.xml
>>>> conf/Catalina/localhost/mywebapp.xml [ references
>>>> C:\apps\myapp.war ]
>>>> 
>>>> Tomcat 8.5 CATALINA_BASE bin/setenv.sh conf/server.xml 
>>>> conf/context.xml conf/web.xml 
>>>> conf/Catalina/localhost/mywebapp.xml [ references
>>>> C:\apps\myapp.war ]
>>>> 
>>>> In this way, your CATALINA_BASE directory only contains a
>>>> handful of configuration files (plus the work/ directory, but
>>>> you let Tomcat worry about that).
>>> 
>>> We host multiple apps.  So each app instance would require its
>>> own CATALINA_BASE for each instance of Tomcat?  This is
>>> beginning to sound like a matrix nightmare.  :-)
>> 
>> It's just more XML files. They will often look the same.
> 
> OK, it's finally beginning to dawn on me. If I understand
> correctly, what you're saying is that each app (context) would have
> its own instance of tomcat running.

Not necessarily. You can deploy them in any arrangement you wish.

> I was hoping to have only one instance of tomcat per tomcat
> version running. So if I wanted to run tomats 6.x and 8.5.x, there
> would only be 2 instances, 2 server.xml files, and 2 listening
> ports. I hoped to have a setting in each server.xml point to a
> different location for the webapps folder. That alternate webapps
> folder could be shared between instances, no matter what version
> they are. Just plop a new application into relocated webapps folder
> just like you would normally in $CATALINA_HOME/webapps.

Both of those should be possible. I was just suggesting that you could
use XML files to deploy your webapps (wherever they may be stored)
instead of just using CATALINA_BASE/webapps. If you want to change the
auto-deployment directory from CATALINA_BASE/webapps to e.g.
/opt/tomcat6 or whatever, that would work, too.

> Sorry, it was my misunderstanding of what CATALINA_BASE was for. 
> When I think of "documents", I think of "webapps", not "conf".

CATALINA_BASE is almost entirely configuration files. The fact that
the default auto-deployment directory is present there muddles things
a bit, but Tomcat is flexible enough to handle a situation where the
auto-deployment directory is elsewhere. I know of no way to re-locate
those configuration files, though.

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlo38fUdHGNocmlzQGNo
cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFggWA//WPfmHlVMG2J7SjN3
TaGKkrJiKNyafWNrj4CfnZpmBGYWsGHCUZNw0QmmybUT2ql/PLS46dbLLmYc3bJb
CWgDpWuhuRsRsN7MbBeq7CU1ETg0dJAPOFeTNbEapTYxkkElwJFglHgEZI2IVC3R
Hv0z3CFDvfjbofaP3TQGIrr5lCgCIsG/6oU7R0HUFQmKknESTUL6jQ3CTpyBBzZA
blwYLk5jokbuopmOnGlNu78SWhGD27DgbSWN9n/S0jq88SVvFcIb+sGf3zcsR6yv
Dv19616VfPG0yrNgFXPIdk9y691TvrpCyxxVtWbsfms/GkZsVez+dciIBMovoZtg
efQrJCYFX1Hr/ZELMt0jPFMRbIdCl1l00G3Xh95z3WZa+MyG9paVuwQz3Lo5+QD2
NiEpicBFqEZLElfeU9G21DCuyfcUAs1iBKJ1Edd99uQ/f+gBAsEbbsjg6x0iHRIY
h4lyh1ACxcO0HVjBRJmOK8joZG1CKc3WxA58GHY5spmTzjaK3pRYoPXIWyAjuItr
duwlWzFcFgfsOlADgBnPwMa0nGVO0fHZhaf0Tx+NRgxGlPwyTKCEE59UmIISDcHF
5HuQYs3Xd3dPxf7qdajSDZihOQaPiUCtFqV6CiVjWMjZF4Yh8ewhIv1dmv/J9JqS
I9LtCwn35IP+arGiKYGf0Do5vxU=
=MeFB
-----END PGP SIGNATURE-----

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


RE: diff tomcat versions share the same CATALINA_BASE?

Posted by "Berneburg, Cris J. - US" <cb...@caci.com>.
Chris

Thanks again taking the time to help.  Please see below.

>>> So I would recommend a separate CATALINA_BASE for each application's 
>>> support for a major Tomcat version. Note that you are welcome to 
>>> share WAR files for an application.
>>> 
>>> Example:
>>> 
>>> Tomcat 6 CATALINA_BASE:
>>> bin/setenv.sh
>>> conf/server.xml 
>>> conf/context.xml
>>> conf/web.xml conf/Catalina/localhost/mywebapp.xml [ 
>>> references C:\apps\myapp.war ]
>>> 
>>> Tomcat 8.5 CATALINA_BASE
>>> bin/setenv.sh
>>> conf/server.xml 
>>> conf/context.xml
>>> conf/web.xml
>>> conf/Catalina/localhost/mywebapp.xml [ 
>>> references C:\apps\myapp.war ]
>>> 
>>> In this way, your CATALINA_BASE directory only contains a handful of 
>>> configuration files (plus the work/ directory, but you let Tomcat 
>>> worry about that).
>> 
>> We host multiple apps.  So each app instance would require its own 
>> CATALINA_BASE for each instance of Tomcat?  This is beginning to sound 
>> like a matrix nightmare.  :-)
>
> It's just more XML files. They will often look the same.

OK, it's finally beginning to dawn on me.  If I understand correctly, what you're saying is that each app (context) would have its own instance of tomcat running.

I was hoping to have only one instance of tomcat per tomcat version running.  So if I wanted to run tomats 6.x and 8.5.x, there would only be 2 instances, 2 server.xml files, and 2 listening ports.  I hoped to have a setting in each server.xml point to a different location for the webapps folder.  That alternate webapps folder could be shared between instances, no matter what version they are.  Just plop a new application into relocated webapps folder just like you would normally in $CATALINA_HOME/webapps.

Sorry, it was my misunderstanding of what CATALINA_BASE was for.  When I think of "documents", I think of "webapps", not "conf".

--
Cris Berneburg
CACI "still struggling" Software Engineer


Re: diff tomcat versions share the same CATALINA_BASE?

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

Cris,

On 12/15/17 1:23 PM, Berneburg, Cris J. - US wrote:
> Chris
> 
> Thanks for taking the time to explain this to me.  I'm still trying
> to absorb it all.  More below.
> 
>>> My question is this.  Is it even possible or simply not
>>> recommended for both tomcat instances to share the same
>>> CATALINA_BASE?  The work folder with compiled cache is buried
>>> in CATALINA_HOME, not under webapps, right?  It also assumes
>>> that no changes need to be made to the application code or
>>> web.xml to accommodate the newer tomcat version.  If changes
>>> need to be made for the new version, then the whole issue
>>> becomes moot.
> 
>> So I would recommend a separate CATALINA_BASE for each
>> application's support for a major Tomcat version. Note that you
>> are welcome to share WAR files for an application.
>> 
>> Example:
>> 
>> Tomcat 6 CATALINA_BASE: bin/setenv.sh conf/server.xml 
>> conf/context.xml conf/web.xml 
>> conf/Catalina/localhost/mywebapp.xml [ references
>> C:\apps\myapp.war ]
>> 
>> Tomcat 8.5 CATALINA_BASE bin/setenv.sh conf/server.xml 
>> conf/context.xml conf/web.xml 
>> conf/Catalina/localhost/mywebapp.xml [ references
>> C:\apps\myapp.war ]
>> 
>> In this way, your CATALINA_BASE directory only contains a handful
>> of configuration files (plus the work/ directory, but you let
>> Tomcat worry about that).
> 
> We host multiple apps.  So each app instance would require its own
> CATALINA_BASE for each instance of Tomcat?  This is beginning to
> sound like a matrix nightmare.  :-)

It's just more XML files. They will often look the same.

>> If you update your WAR file, both services will be updated with
>> your latest code.
> 
> We don't (yet) use WAR files, but rather exploded directories.  In
> your example, can conf/Catalina/localhost/mywebapp.xml reference
> C:\apps\myapp (folder)?

Definitely. The only situation I think where Tomcat cares about the
difference between a WAR file and an exploded WAR directory structure
is when using the manager to deploy an application: you must deploy a
WAR file and can't upload a directory structure. Otherwise, those two
entities are entirely interchangeabile.

- -chris

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlo0GiMdHGNocmlzQGNo
cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFjEIw/9HV9xypcf78elgY/2
Q0ZhE/jvJ8LrGs9vzSQ0xCBrOCjyr0bY4CXFX8GA7YnXovmhKJBvuDaSqzNGyAc/
81K67HqTEFN2Xw0rkLUbbJhhnCSKcm2baXpeayBPF0G08V0eKrKwXOKdKkXrms02
A2L8uS0PpVdLccDXI0FF/s4tB6DYxJCTnMC78ygYmUsLrvbWn9TiltGr/e0Pwh36
H8HKvywU2GMgpbSvEbvyqTHaCNE6TjCQQY5nSg83QT8+qLKBMnFVIxSfUsXbH1DJ
KsXFz4nI1+ukuRaweCjHYvToZEw9VJspfZ5KjtN3jYXvhcQJDPx1QZmMHPSJIEPB
3AbLJX5LK0JCIWStywTmoj6ZKq/2kJ7sVx4p+Mh/2SdMeNDWjSpyaU7aASEDCdu9
qheeGT7gx9VETPAq/aHi7NgN/oaWyJ3Vu3PGN6mA6wUG8Z3SiRQlXH00iJSiUqgx
d8gHqUn26dXOOfVSC3fG90CvH/P+TYj+oBBvtKzRlgWDxuhfyYewvTdSyUICq+ew
zb7r/8d+xGH4GlNdFM2hCn8LCTi2xXmmOJWc+lDF8v27u8h5aGFMgXUwFTKPA1eP
DKIqyL8+vMhSK7aq6ba3Uon8fpGrs7RnnbfJvTZUpn2FQhqDADuQ5a4nMK1OO5u6
xdo4SGUETZg0gQFfRK9CCe0dlko=
=7MSr
-----END PGP SIGNATURE-----

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


RE: diff tomcat versions share the same CATALINA_BASE?

Posted by "Berneburg, Cris J. - US" <cb...@caci.com>.
Chris

Thanks for taking the time to explain this to me.  I'm still trying to absorb it all.  More below.

> > My question is this.  Is it even possible or simply not recommended 
> > for both tomcat instances to share the same CATALINA_BASE?  The work 
> > folder with compiled cache is buried in CATALINA_HOME, not under 
> > webapps, right?  It also assumes that no changes need to be made to 
> > the application code or web.xml to accommodate the newer tomcat 
> > version.  If changes need to be made for the new version, then the 
> > whole issue becomes moot.

> So I would recommend a separate CATALINA_BASE for each application's
> support for a major Tomcat version. Note that you are welcome to share
> WAR files for an application.
> 
> Example:
> 
> Tomcat 6 CATALINA_BASE:
> bin/setenv.sh
> conf/server.xml
> conf/context.xml
> conf/web.xml
> conf/Catalina/localhost/mywebapp.xml [ references C:\apps\myapp.war ]
> 
> Tomcat 8.5 CATALINA_BASE
> bin/setenv.sh
> conf/server.xml
> conf/context.xml
> conf/web.xml
> conf/Catalina/localhost/mywebapp.xml [ references C:\apps\myapp.war ]
> 
> In this way, your CATALINA_BASE directory only contains a handful of
> configuration files (plus the work/ directory, but you let Tomcat
> worry about that).

We host multiple apps.  So each app instance would require its own CATALINA_BASE for each instance of Tomcat?  This is beginning to sound like a matrix nightmare.  :-)

> If you update your WAR file, both services will be updated with your
> latest code.

We don't (yet) use WAR files, but rather exploded directories.  In your example, can conf/Catalina/localhost/mywebapp.xml reference C:\apps\myapp (folder)?

--
Cris Berneburg
CACI Lead Software Engineer


Re: diff tomcat versions share the same CATALINA_BASE?

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

Cris,

On 12/15/17 10:36 AM, Berneburg, Cris J. - US wrote:
> I'm thinking about upgrading our tomcat from version 6.x to 8.5.x. 
> Yeah, it's overdue.  :-)  In our test environment, I would like to 
> install 8.5 in parallel with 6 for side-by-side comparison
> testing.

Sounds reasonable.

> Having never done it before, I'm also thinking about splitting the 
> tomcat and document locations with different values for
> CATALINA_HOME home CATALINA_BASE.

This is critical for a sane environment IMO.

> So each tomcat instance, 6 and 8, would need its own copy of
> CATALINA_HOME.  Running under Windows Server as a service,
> CATALINA_HOME would need to be somehow configured differently for
> each service.  I assume that can be figured out somehow.  Hints are
> welcome.  ;-)

set CATALINA_HOME=...\tomcat6
set CATALINA_BASE=...\app1
CATALINA_HOME/bin/service.bat [args]

The service.bat file (and accompanying binary) are sensitive to the
standard environment variables. As long as you set-up your Windows
service using service.bat and those env vars are set, you are good to go
.

If you want to change CATALINA_HOME, you may want to actually *remove*
the Windows service and re-install it; I'm not sure how well it works
to try to "change" the CATALINA_HOME for an existing service.

> My question is this.  Is it even possible or simply not
> recommended for both tomcat instances to share the same
> CATALINA_BASE?  The work folder with compiled cache is buried in
> CATALINA_HOME, not under webapps, right?  It also assumes that no
> changes need to be made to the application code or web.xml to
> accommodate the newer tomcat version.  If changes need to be made
> for the new version, then the whole issue becomes moot.
> 
> Just in case you're curious why ... I'm a developer.  :-)

Sharing CATALINA_BASE between major Tomcat versions is not a great
idea specifically because of conf/server.xml. That file is very
sensitive to changes across versions of Tomcat.

Take the <Connector> elements for instance. In Tomcat 6, there is no
configuration for SNI, multiple certificates per domain, etc., but
that's the best way to configure Tomcat 8.5.

So I would recommend a separate CATALINA_BASE for each application's
support for a major Tomcat version. Note that you are welcome to share
WAR files for an application.

Example:

Tomcat 6 CATALINA_BASE:
bin/setenv.sh
conf/server.xml
conf/context.xml
conf/web.xml
conf/Catalina/localhost/mywebapp.xml [ references C:\apps\myapp.war ]

Tomcat 8.5 CATALINA_BASE
bin/setenv.sh
conf/server.xml
conf/context.xml
conf/web.xml
conf/Catalina/localhost/mywebapp.xml [ references C:\apps\myapp.war ]

In this way, your CATALINA_BASE directory only contains a handful of
configuration files (plus the work/ directory, but you let Tomcat
worry about that).

If you update your WAR file, both services will be updated with your
latest code.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAloz+J0dHGNocmlzQGNo
cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFhJYRAAriV8XMoZjcSd08BL
sytAXGTXSTTDjTNpumE+l6AhpIsNU1oTTxkbx6qFujNjlBNDmwC7PoJ9gpZlyMDG
70jb5/7kFNaKE3/UqaECBNx2HQpvIU+5UnjF/tgIreEPnDdc34OnHOS7WhoSEq0E
CgCh3rzDI3LAeq1B0mLccfnRyl81Bia3itYdO3+4q1XISPB0UAhvMSV1x5/bU4zu
W8WHG4jNssLCYUjqmXQv2uEmm0fOraWxSwBhvGr6uy7vGXhrl70ewktTZwx5t7L4
8RDwaEUtX/SId/nX+QhdGLOthmnytc2GZmMAPsQooXTLYVOcTt4aJKsWqxpELwAD
JDwg+hs2jTrTbEbfjGuoFXC7XymXtTiP+K7lwn9nFI9nHERKLb57Uj3Pd1IGnZxa
5qrBJnZHW1qF1qcj3VGuUuvH+YGHfguT5v1DDgdPjfrzi/daXS8Z/ote2GVMvslD
OVU95F8qlu6GING0K5n9I2yCOlIq7JjNXjNOora3xOyZ6ITpUkC3dzOaEM1DzLS9
6cTnMcj9m/OHk8shRtwviZLaRToBFBqLKbwQv6JsMyE3JyXiCFIiP9r9CjSCOAio
zMJSLQ45VwwGyLhxSERw/STunIRK9XPzpa0A38COtiAZKXd3pMiTG9RiTUWGT+t0
g8/4iEE7ndM5jgYRHFznqdsPrfs=
=qgzx
-----END PGP SIGNATURE-----

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