Tomcat and CATALINA_HOME
Solution 1
Those environment variables are optional. If there are none set on the system, Tomcat will just set some defaults based on the location of the currently running script (the startup.sh
and so on), which will be used as long as Tomcat is running. If you know Shell script language, just open catalina.sh
file in an editor and read it.
Solution 2
If you take a look into catalina.sh
(which is called from startup.sh
) you will notice that in case CATALINA_HOME is not set it automatically sets it to one level above of the program executable:
[ -z "$CATALINA_HOME" ] && CATALINA_HOME=`cd "$PRGDIR/.." ; pwd`
and CATALINA_BASE, if absent, is set equal to CATALINA_HOME:
if [ -z "$CATALINA_BASE" ] ; then
CATALINA_BASE="$CATALINA_HOME"
fi
So there's no real requirement for the variables to be set.
Andna
Updated on June 04, 2022Comments
-
Andna almost 2 years
I am messing with Tomcat server and I think some strange thing happened. I downloaded Tomcat 7 from apache website (not an RPM but tar.gz). As I understand there should be CATALINA_HOME and CATALINA_BASE environment variables set, but when I do export on my terminal I can't see any of them, but server starts fine through bin/startup.sh and it even says
Using CATALINA_BASE: /home/andrzej/apache-tomcat-7.0.25 Using CATALINA_HOME: /home/andrzej/apache-tomcat-7.0.25 Using CATALINA_TMPDIR: /home/andrzej/apache-tomcat-7.0.25/temp Using JRE_HOME: /usr/lib/jvm/jre Using CLASSPATH: /home/andrzej/apache-tomcat-7.0.25/bin/bootstrap.jar:/home/andrzej /apache-tomcat-7.0.25/bin/tomcat-juli.jar
I think that the other day variables were set, but now I tried to use them with keytool to generate certificate and I noticed they are not there. Am I missing something, because even if I can't see them everything works fine (startup/shutdown and eclipse with tomcat)?