我如何找到 $CATALINA_HOME 的值? [英] How do I find the value of $CATALINA_HOME?
问题描述
我必须将 Connnector/J
JAR 复制到 Amazon EC2
上的 Tomcat7 的 $CATALINA_HOME/lib
中.如何在 Amazon EC2 中的 Amazon Linux 上找到 $CATALINA_HOME/lib
的完整路径?
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 可以通过多种方式告诉您.这是最简单的:
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.
如果你不知道 catalina.sh
在哪里(或者它永远不会被调用),你通常可以通过 ps
找到它:
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
从 ps
输出中,您可以看到 catalina.home
和 catalina.base
.catalina.home
是Tomcat 基础文件的安装位置,catalina.base
是Tomcat 的运行配置所在.这些通常设置为相同的值,除非您已将 Tomcat 配置为从单个 Tomcat 基础安装启动的多个(配置)实例.
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.
如果在ps
列表中找不到,也可以直接查询JVM:
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
如果您无法做到这一点,您总是可以尝试编写一个 JSP,转储两个系统属性 catalina.home
和 catalina.base
的值.
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
.
这篇关于我如何找到 $CATALINA_HOME 的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!