【发布时间】:2014-09-19 20:13:09
【问题描述】:
场景很简单。我正在尝试从我的本地工作站 (Mac OS 10.9) 监控运行 Tomcat 7.0.54 的远程服务器 (Ubuntu 12.04),其中我的 Spring Java 应用已部署。
JVM 热点 64bit "1.7.0_51" 用于服务器和工作站。
步骤
-
配置 Tomcat 的 JmxRemoteLifecycleListener 以修复端口 (server.xml)
<Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiRegistryPortPlatform="9940" rmiServerPortPlatform="9941" /> 将 catalina-jmx-remote.jar 复制到 CATALINA_HOME/lib 中
-
开放端口 sudo iptables -L
ACCEPT tcp -- anywhere anywhere tcp dpt:9940 ACCEPT tcp -- anywhere anywhere tcp dpt:9941 -
setenv.sh
IP=`ifconfig eth0 | grep 'inet '| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`; export CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.local.only=false -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=true -Djava.rmi.server.hostname=$IP -Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password -Dcom.sun.management.jmxremote.access.file=$CATALINA_BASE/conf/jmxremote.access -Dcom.sun.management.jmxremote.ssl=false"IP 被解析为主机的内部 IP 地址,例如 10.239.94.133。
-
启动 Tomcat 并检查 netstat -nap | grep java
tcp6 0 0 :::9940 :::* LISTEN 6538/java tcp6 0 0 :::9941 :::* LISTEN 6538/java到这里为止,这一切似乎都表明设置是正确的。我可以远程登录我的远程主机到两个端口,我可以看到 Tomcat(6538) 正在监听这些端口。
-
从我的本地主机 jconsole -debug 并连接到远程进程
service:jmx:rmi://PUBLIC-IP:9941/jndi/rmi://PUBLIC-IP:9940/jmxrmi
问题
java.lang.SecurityException: Expecting a javax.rmi.ssl.SslRMIClientSocketFactory RMI client socket factory in stub!
at javax.management.remote.rmi.RMIConnector.checkStub(RMIConnector.java:1881)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:295)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:268)
at sun.tools.jconsole.ProxyClient.tryConnect(ProxyClient.java:370)
at sun.tools.jconsole.ProxyClient.connect(ProxyClient.java:313)
at sun.tools.jconsole.VMPanel$2.run(VMPanel.java:292)
有什么我错过的吗?我在这个圈子里跑来跑去:-/谢谢你的帮助。
【问题讨论】: