一尘不染

如何找到$ CATALINA_HOME的值?

tomcat

我必须在上复制 Tomcat7中的Connnector/JJAR 。如何在Amazon EC2中的Amazon
Linux上找到的完整路径?$CATALINA_HOME/lib``Amazon EC2``$CATALINA_HOME/lib


阅读 1871

收藏
2020-06-16

共1个答案

一尘不染

Tomcat可以通过几种方式告诉您。这是最简单的:

 $ /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以下方式找到它:

$ 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.homecatalina.basecatalina.home是Tomcat基本文件的安装位置,catalina.base也是Tomcat正在运行的配置所在的位置。除非您已为从单个Tomcat基本安装启动的多个(配置)实例配置了Tomcat,否则通常将它们设置为相同的值。

如果在ps清单中找不到JVM,也可以直接查询JVM :

$ 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

2020-06-16