Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TOMCAT_HOME vs CATALINA_HOME

Tags:

tomcat

tomcat8

I have been updating some documentation lately (we moved from Apache Tomcat 7 to 8) and noticed references to TOMCAT_HOME. Such as creating an environment variable TOMCAT_HOME. If I'm correct TOMCAT_HOME was pretty much deprecated in version 3 and replaced with CATALINA_HOME and CATALINA_BASE? However, I couldn't find any definitive article on this or when to use TOMCAT_HOME over CATALINA_HOME. Certainly I'm not setting both!? Is there any definitive answer on this? Do popular third party applications look for TOMCAT_HOME rather than CATALINA_HOME?

like image 805
DavidR Avatar asked May 27 '16 21:05

DavidR


People also ask

What is the difference between Catalina_home and Catalina_base?

CATALINA_HOME: Represents the root of your Tomcat installation, for example /home/tomcat/apache-tomcat-9.0. 10 or C:\Program Files\apache-tomcat-9.0. 10 . CATALINA_BASE: Represents the root of a runtime configuration of a specific Tomcat instance.

What is $Catalina_home?

CATALINA_HOME is the folder where Apache Tomcat is installed e.g. c:\program files\Apache Tomcat or /usr/apache/tomcat . It is the folder where you unzip Tomcat in the first place (when you install from zip).

What should Catalina_home be set to?

The CATALINA_HOME environment variable should be set to the location of the root directory of the "binary" distribution of Tomcat. The Tomcat startup scripts have some logic to set this variable automatically if it is absent, based on the location of the startup script in *nix and on the current directory in Windows.

Where can I find Catalina_home?

By default, CATALINA_HOME is /usr/share/tomcat6 , and CATALINA_BASE is /var/lib/tomcat6 . In either Tomcat6 or Tomcat7 installed with Apt-Get, find the declarations of CATALINA_HOME and CATALINA_BASE, in /etc/init. d/tomcat6 or tomcat7, and EXPORT them to the OS variables. They are then visible on a ENV command.


2 Answers

There is no TOMCAT_HOME and there wasn't any. There is only CATALINA_* -- still in Tomcat 9. I assume that Mark Thomas did not touch this for compat reasons.

Don't invent your own env variables -- they will only cause confusion.

like image 120
Michael-O Avatar answered Nov 18 '22 20:11

Michael-O


Tomcat is split into 2 parts. One part is common to all instances of Tomcat. It contains things like the bin and lib directories.

The other part is replicated per-instance. It contains the work, temp and log directories. And conf, which is where the server.xml that defines what ports a given Tomcat instance uses.

So to run (and start/stop) multiple Tomcat instances, you no longer have CATALINA_HOME and CATALINA_BASE aimed at the same "TOMCAT_HOME" directory, but instead you have one CATALINA_HOME for all the Tomcats and a separate CATALINA_BASE for each Tomcat.

If you are running multiple instances of Tomcat on a single host you should set CATALINA_BASE to be equal to the .../tomcat_instance1 or .../tomcat_instance2 directory as appropriate for each instance and the CATALINA_HOME environment variable to the common Tomcat installation whose files will be shared between the two instances.

like image 21
Tanvi B Avatar answered Nov 18 '22 20:11

Tanvi B