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