Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find the value of $CATALINA_HOME?

Tags:

tomcat

tomcat7

I have to copy Connnector/J JAR in $CATALINA_HOME/lib of Tomcat7 on Amazon EC2. How to find the full path of $CATALINA_HOME/lib on Amazon Linux in Amazon EC2?

like image 785
Gaurav Agarwal Avatar asked Jul 15 '12 22:07

Gaurav Agarwal


People also ask

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.

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 is Catalina_home lib in Windows?

set JAVA_HOME=C:\ "top level directory of your java install" set CATALINA_HOME=C:\ "top level directory of your Tomcat install"


1 Answers

Tomcat can tell you in several ways. Here's the easiest:

 $ /path/to/catalina.sh version Using CATALINA_BASE:   /usr/local/apache-tomcat-7.0.29 Using CATALINA_HOME:   /usr/local/apache-tomcat-7.0.29 Using CATALINA_TMPDIR: /usr/local/apache-tomcat-7.0.29/temp Using JRE_HOME:        /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home Using CLASSPATH:       /usr/local/apache-tomcat-7.0.29/bin/bootstrap.jar:/usr/local/apache-tomcat-7.0.29/bin/tomcat-juli.jar Server version: Apache Tomcat/7.0.29 Server built:   Jul 3 2012 11:31:52 Server number:  7.0.29.0 OS Name:        Mac OS X OS Version:     10.7.4 Architecture:   x86_64 JVM Version:    1.6.0_33-b03-424-11M3720 JVM Vendor:     Apple Inc. 

If you don't know where catalina.sh is (or it never gets called), you can usually find it via ps:

$ ps aux | grep catalina chris            930   0.0  3.1  2987336 258328 s000  S    Wed01PM   2:29.43 /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Dnop -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.library.path=/usr/local/apache-tomcat-7.0.29/lib -Djava.endorsed.dirs=/usr/local/apache-tomcat-7.0.29/endorsed -classpath /usr/local/apache-tomcat-7.0.29/bin/bootstrap.jar:/usr/local/apache-tomcat-7.0.29/bin/tomcat-juli.jar -Dcatalina.base=/Users/chris/blah/blah -Dcatalina.home=/usr/local/apache-tomcat-7.0.29 -Djava.io.tmpdir=/Users/chris/blah/blah/temp org.apache.catalina.startup.Bootstrap start 

From the ps output, you can see both catalina.home and catalina.base. catalina.home is where the Tomcat base files are installed, and catalina.base is where the running configuration of Tomcat exists. These are often set to the same value unless you have configured your Tomcat for multiple (configuration) instances to be launched from a single Tomcat base install.

You can also interrogate the JVM directly if you can't find it in a ps listing:

$ jinfo -sysprops 930 | grep catalina Attaching to process ID 930, please wait... Debugger attached successfully. Server compiler detected. JVM version is 20.8-b03-424 catalina.base = /Users/chris/blah/blah [...] catalina.home = /usr/local/apache-tomcat-7.0.29 

If you can't manage that, you can always try to write a JSP that dumps the values of the two system properties catalina.home and catalina.base.

like image 72
Christopher Schultz Avatar answered Sep 28 '22 07:09

Christopher Schultz