Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat and CATALINA_HOME

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)?

like image 684
Andna Avatar asked May 14 '26 04:05

Andna


2 Answers

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.

like image 135
BalusC Avatar answered May 15 '26 18:05

BalusC


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.

like image 24
Oleg Mikheev Avatar answered May 15 '26 18:05

Oleg Mikheev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!