Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Still cannot connect Tomcat 6 remotely via VisualVM

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)

like image 957
er4z0r Avatar asked Feb 03 '23 06:02

er4z0r


2 Answers

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.

like image 122
Tom Avatar answered Feb 05 '23 20:02

Tom


Check out the jmx listener on this page. http://tomcat.apache.org/tomcat-6.0-doc/config/listeners.html

It lets you set both the JMX port and the RMI registry port, both of which have to open on your firewall.

like image 32
John Russell Avatar answered Feb 05 '23 19:02

John Russell