java.lang.SecurityException when JMX monitor Tomcat from JConsole -
the scenario simple. i'm trying monitor local workstation (mac os 10.9) remote server (ubuntu 12.04) that's running tomcat 7.0.54 spring java app deployed.
jvm hotspot 64bit "1.7.0_51" used in both server , workstation.
the steps
configure tomcat's jmxremotelifecyclelistener fix ports (server.xml)
<listener classname="org.apache.catalina.mbeans.jmxremotelifecyclelistener" rmiregistryportplatform="9940" rmiserverportplatform="9941" />
copy catalina-jmx-remote.jar catalina_home/lib
open ports 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 gets resolved host's internal ip address, 10.239.94.133.
start tomcat , check netstat -nap | grep java
tcp6 0 0 :::9940 :::* listen 6538/java tcp6 0 0 :::9941 :::* listen 6538/java
up here seems indicate setup correct. can telnet remote host both ports , can see tomcat(6538) listening ports.
from local host jconsole -debug , connect remote process
service:jmx:rmi://public-ip:9941/jndi/rmi://public-ip:9940/jmxrmi
the problem
java.lang.securityexception: expecting javax.rmi.ssl.sslrmiclientsocketfactory rmi client socket factory in stub! @ javax.management.remote.rmi.rmiconnector.checkstub(rmiconnector.java:1881) @ javax.management.remote.rmi.rmiconnector.connect(rmiconnector.java:295) @ javax.management.remote.jmxconnectorfactory.connect(jmxconnectorfactory.java:268) @ sun.tools.jconsole.proxyclient.tryconnect(proxyclient.java:370) @ sun.tools.jconsole.proxyclient.connect(proxyclient.java:313) @ sun.tools.jconsole.vmpanel$2.run(vmpanel.java:292)
is there i've missed? i'm running in circles :-/ help.
ip gets resolved host's internal ip address, 10.239.94.133.
that problem. fix set
-djava.rmi.server.hostname=server.public.ip.address
you still same error in jconsole (with -debug option) disregard , click on 'insecure' button continue , in :)
Comments
Post a Comment