Still cannot connect Tomcat 6 remotely via VisualVM

er4z0r picture er4z0r · Feb 19, 2010 · Viewed 18.9k times · Source

If checked the other questions regarding this issue but so far no soultion. Here is my setup: TC6 runs on a debian vm on my macbook. in /etc/default/tomcat6.0 I have following options set:

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

netstat -ntlp gives me:

tcp6       0      0 :::8080                 :::*                    LISTEN      6550/java
tcp6       0      0 :::8086                 :::*                    LISTEN      6550/java

Where 6550:

root      6550  3.3  6.8 224888 52984 pts/0    Sl   10:31   0:43 /usr/lib/jvm/java-6-sun/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/var/lib/tomcat6.0/conf/logging.properties -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8086 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.endorsed.dirs=/usr/share/tomcat6.0/common/endorsed -classpath :/usr/lib/jvm/java-6-sun/jre//lib/jcert.jar:/usr/lib/jvm/java-6-sun/jre//lib/jnet.jar:/usr/lib/jvm/java-6-sun/jre//lib/jsse.jar:/usr/share/tomcat6.0/bin/bootstrap.jar:/usr/share/tomcat6.0/bin/commons-logging-api.jar -Dcatalina.base=/var/lib/tomcat6.0 -Dcatalina.home=/usr/share/tomcat6.0 -Djava.io.tmpdir=/var/lib/tomcat6.0/temp org.apache.catalina.startup.Bootstrap start

Firewall:

Chain INPUT (policy DROP)
target     prot opt source               destination         
ACCEPT     all      anywhere             anywhere            

Chain FORWARD (policy DROP)
target     prot opt source               destination         

Chain OUTPUT (policy DROP)
target     prot opt source               destination         
ACCEPT     all      anywhere             anywhere 

When I try to connect from OSX using jvisualm: - adding a new host with the hostname of my vm (added it to /etc/hosts) - adding a new JMX-Connection

VisualVM fails with:

Cannot connect using service:jmx:rmi///jndi/rmi://<vmhostname>:8086/jmxrmi

When I connect to my VM using ssh -X and start jvisualvm on the same machine that tomcat is running on, I do not initially see TC, but I can add the jmx connection as above.

Could this be an issue with foreign hosts being misteriously prevented to access the rmiregistry? Why would anyone do such a dumb thing?

What am I doing wrong?

(sorry 4 the lengthy post)

Answer

Tom picture Tom · Feb 5, 2012

Here is a tutorial on how to connect Visual VM to Tomcat 7. It is a bit on the verbose side, but should help steer you around a number of the problems most people run into.