当前位置: 代码迷 >> Web前端 >> Tomcat 七 配置远程JMX支持穿透防火墙
  详细解决方案

Tomcat 七 配置远程JMX支持穿透防火墙

热度:588   发布时间:2012-12-27 10:17:10.0
Tomcat 7 配置远程JMX支持穿透防火墙

参考Tomcat7官方文档:http://tomcat.apache.org/tomcat-7.0-doc/config/listeners.html#JMX_Remote_Lifecycle_Listener_-_org.apache.catalina.mbeans.JmxRemoteLifecycleListener

?

1.从http://tomcat.apache.org/download-70.cgi 下载JMX Remote jar(文件名catalina-jmx-remote.jar),保存到 $CATALINA_HOME/lib;

?

2.修改$CATALINA_BASE/server.xml,加入listener配置:<Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiRegistryPortPlatform="10001" rmiServerPortPlatform="10002" />

修改后的server.xml如下:

<Server port="8005" shutdown="SHUTDOWN">
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiRegistryPortPlatform="10001" rmiServerPortPlatform="10002" />

?

3.在$CATALINA_BASE/bin目录下创建setenv.sh文件,内容如下:

#!/bin/sh

CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"

?给setenv.sh授执行权限

?

4.启动Tomcat

?

5.使用jconsole连接Tomcat,在远程进程中输入:<Tomcat IP>:10001

  相关解决方案