Tomcat parameters are CATALINA_BASE and CATALINA_HOME

I have several instances of tomcat 6 running on the same server (Linux), and it works as expected. I am trying to figure out what standard practice is with respect to setting the CATALINA_HOME and CATALINA_BASE .

In my tomcat installation, I have setup CATALINA_HOME to point to the β€œshared” folder (say /tomcat6 ), and the CATALINA_BASE variable changes depending on the instance name (say /tomcat_instance1 , /tomcat_instance2 )

My question is:

  • Do I need two variables?
  • Or can I just leave CATALINA_HOME and do away with CATALINA_BASE (or vice versa)?
+63
linux tomcat instance-variables
Jun 22 '10 at 5:00
source share
6 answers

If you use multiple instances of Tomcat on the same host, you must set CATALINA_BASE to be the directory .../tomcat_instance1 or .../tomcat_instance2 appropriate for each instance, and the CATALINA_HOME environment CATALINA_HOME for shared Tomcat to be shared between the two instances.

The CATALINA_BASE environment is optional if you are using a single Tomcat instance on the host and defaults to CATALINA_HOME in this case. If you run multiple instances like you, it should be provided.

There is a pretty good description of this installation in the RUNNING.txt file in the root directory of the Apache Tomcat distribution under the heading Advanced setup - multiple instances of Tomcat

+71
Dec 21 '11 at 3:25
source share

CATALINA_HOME vs CATALINA_BASE

If you use multiple instances, you need both variables, otherwise only CATALINA_HOME .

In other words: CATALINA_HOME is required, and CATALINA_BASE is optional.

CATALINA_HOME represents the root of your Tomcat installation.

Optionally, Tomcat can be configured for multiple instances by defining $CATALINA_BASE for each instance. If multiple instances are not configured, $CATALINA_BASE same as $CATALINA_HOME .

See: Apache Tomcat 7 - Introduction

Work with individual CATALINA_HOME and CATALINA_BASE documented in the RUNNING.txt file, which states:

The CATALINA_HOME and CATALINA_BASE environment CATALINA_HOME CATALINA_BASE used to specify the location of Apache Tomcat and the location of its active configuration, respectively.

You cannot configure the CATALINA_HOME and CATALINA_BASE in setenv script because they are used to find this file.

For example:

(4.1) Tomcat can be started by doing one of the following: commands:

  %CATALINA_HOME%\bin\startup.bat (Windows) $CATALINA_HOME/bin/startup.sh (Unix) 

or

  %CATALINA_HOME%\bin\catalina.bat start (Windows) $CATALINA_HOME/bin/catalina.sh start (Unix) 

Multiple Tomcat Instances

In many cases, it is desirable to have one copy of Tomcat Binary Distribution shared by several users on the same server. To make this possible, you can set the CATALINA_BASE environment variable to a directory containing the files for your "personal" instance of Tomcat.

When working with individual CATALINA_HOME and CATALINA_BASE , files and directories are separated as follows:

In CATALINA_BASE :

  • bin - Only: setenv.sh (* nix) or setenv.bat (Windows), tomcat-juli.jar
  • conf - Server configuration files (including server.xml)
  • lib - Libraries and classes as described below
  • logs - Log and output files
  • webapps - Automatically downloaded web applications
  • work - Temporary working directories for web applications
  • temp - The directory used by the JVM for temporary files>

In CATALINA_HOME :

  • bin - startup and shutdown scripts
  • lib - Libraries and classes as described below
  • endorsed - libraries that override the standard "approved standards". By default, it is absent.

How to check

The easiest way to verify that you are doing CATALINA_BASE and CATALINA_HOME by running startup.sh , for example:

 $ /usr/share/tomcat7/bin/startup.sh Using CATALINA_BASE: /usr/share/tomcat7 Using CATALINA_HOME: /usr/share/tomcat7 

You can also check where Tomcat files are installed using the dpkg tool as shown below (Debian / Ubuntu):

 dpkg -L tomcat7-common 
+47
Apr 01 '15 at 19:00
source share

I can’t say that I know the best practice, but here is my perspective.

Are you using these variables?

Personally, I did not need to change to Linux or Windows, in environments that differ from development to production. If you are not doing something special that relies on them, chances are you can leave them alone.

catalina.sh sets the variables that Tomcat should work out of the box. It also states that CATALINA_BASE is optional:

 # CATALINA_HOME May point at your Catalina "build" directory. # # CATALINA_BASE (Optional) Base directory for resolving dynamic portions # of a Catalina installation. If not present, resolves to # the same directory that CATALINA_HOME points to. 

I am sure you will find out if your setup works when you start your server.

+10
Jun 22 '10 at 5:15
source share

This has nothing to do with multiple instances. Two environment variables allow you to separate Tomcat binaries from Tomcat configuration files.

By default, CATALINA_BASE (configurations) and CATALINA_HOME (binaries) point to the same folder.

But specifying CATALINA_BASE in another directory allows you to separate the configuration directory from the binary directory pointed to by CATALINA_HOME .

This is very useful if you want to update binary files without changing or requiring backup / restore of configuration files for Tomcat, or in cases where you want to run multiple instances of Tomcat side by side with different configurations.

To take advantage of this feature, simply create the config directory and point to it with the CATALINA_BASE environment CATALINA_BASE . You will need to put some files in this directory:

  • Copy the conf directory from the Tomcat installation source directory, including its contents, and verify that Tomcat has read permissions. Edit the configuration files to suit your needs.
  • Create a logs directory if conf/logging.properties points to ${catalina.base}/logs and verify that Tomcat has read / write permissions.
  • Create a temp directory if you do not override the default value of $CATALINA_TMPDIR , which points to ${CATALINA_BASE}/temp , and make sure that Tomcat has write permissions.
  • Create the default work directory ${CATALINA_BASE}/work and make sure that Tomcat has write permissions.
+5
May 22 '16 at 9:45 pm
source share

CATALINA_BASE is optional.

However, in the following scenarios, this helps to configure CATALINA_BASE, which is separate from CATALINA_HOME.

  • When more than one tomcat instance is running on the same host

    • This helps to have only 1 tomcat installation run time, with several CATALINA_BASE server configurations running on different ports.
    • If any correction or update of the version is necessary, only one change of installation is required or it is necessary to check / check / cancel.
  • Separation of Anxiety (Single Responsibility)

    • Tomcat runtime is standard and does not change during each release process. those. tomcat binaries
    • The release process can add more things as a web application (webapps folder), environment configuration (conf directory), log directory / temp / work
0
Aug 02 '16 at 15:20
source share

This is the parent bin folder that contains the tomcat.exe file:

 CATALINA_HOME='C:\Program Files\Apache Software Foundation\Tomcat 6.0' 

CATALINA_BASE same as CATALINA_HOME .

-3
Jan 05 '15 at 14:18
source share



All Articles