Iam new to tomcat but i knew something in java, While setting up tomcat we use to set java_home for the jdk path but all i wanted to knew what is catalina_home and why we need to setup in catalina.sh?
Tomcat is actually composed of a number of components, including a Tomcat JSP engine and other connectors, but the main component is Catalina, which provides the implementation of the servlet specification. When starting the Tomcat server, it's Catalina that is actually starting. The variable 'catalina_home' is a configuration property that stores the location of the Catalina files.
These are the configuration files in Tomcat's "$CATALINA_BASE/conf" directory:
- catalina.policy
- catalina.properties
- logging.properties
- content.xml
- server.xml
- tomcat-users.xml
- web.xml
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).
CATALINA_HOME
is necessary because a lot of the files Tomcat will use are referred to from the variable CATALINA_HOME
. For instance log files are written inside CATALINA_HOME/logs
. Configuration is read from CATALINA_HOME/conf
.
If you try to run Tomcat with the wrong CATALINA_HOME
, things will go wrong.
Tomcat is actually composed of a number of components, including a Tomcat JSP engine and other connectors, but the main component is Catalina, which provides the implementation of the servlet specification. When starting the Tomcat server, it's Catalina that is actually starting. The variable 'catalina_home' is a configuration property that stores the location of the Catalina files.
These are the configuration files in Tomcat's "$CATALINA_BASE/conf" directory:
- catalina.policy
- catalina.properties
- logging.properties
- content.xml
- server.xml
- tomcat-users.xml
- web.xml
Setting CATALINA_HOME is not required
The file catalina.bat|sh
is dependent on CATALINA_HOME. Catalina home is the base directory used to
- set environment variables (setenv.bat)
- set classpath (setclasspath.bat)
among other things.
Simply run the startup.sh|bat
or catalina.sh|bat
from the tomcat directory. It will automatically set the variable.
rem Guess CATALINA_HOME if not defined
set "CURRENT_DIR=%cd%"
if not "%CATALINA_HOME%" == "" goto gotHome
set "CATALINA_HOME=%CURRENT_DIR%"
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
cd ..
set "CATALINA_HOME=%cd%"
cd "%CURRENT_DIR%"
:gotHome
CATALINA_BASE == CATALINA_HOME
Both the variables do the same thing, they are used as base directory variables. If CATALINA_BASE is not set, CATALINA_HOME is copied into it.
# Copy CATALINA_BASE from CATALINA_HOME if not already set
[ -z "$CATALINA_BASE" ] && CATALINA_BASE="$CATALINA_HOME"
© 2022 - 2024 — McMap. All rights reserved.