How to control Tomcat6 using JVisualvm on Ubuntu Linux?

I am trying to configure JVisualVm to monitor an instance of Tomcat 6 (works on Ubuntu Server 10.04 LTS). I saw other questions, but none of them directly answered my problem. I try to connect to Tomcat using JVisualvm, and it returns with the error "Cannot connect", but TCP connections are made on the server; the server disconnects the connection after a short burst of traffic.

I already added this to / etc / default / tomcat 6 and restarted tomcat6

# This enables JMX in order to permit VisualVM to profile the JVM. JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false" 

I started rmiregistry using the default settings:

 rmiregistry & 

I did not start jstatd ; installing it on the server requires a full JDK, which requires the X libraries. I am not going to install X just to get one single file.

I wonder if jstatd will work with it? I got the impression that I don't need either RMI or jstatd if I can use JMX directly through the JMX port.

There is no firewall between the server and the JVisualvm client, and the iptables host firewall is open. Using jconsole results in the same error.

Running JVisualVM against the local Ubuntu 10.04 machine (using its IP address and JMX port) and adding a JMX instance works fine - and I don't run either rmiregistry or jstatd - although the RMI streams that are running are displayed on the monitor.

Question: What should I do (on the server or on the client) to control Tomcat (and other Java programs) through JMX using JVisualVM?

Thanks in advance.

+4
source share
2 answers

If there is no firewall, try setting the system property java.rmi.server.hostname for your Tomcat. Add this to your Tomcat JAVA_OPTS:

 -Djava.rmi.server.hostname=<IP address of Ubuntu Server> 

You do not need to run rmiregistry , and you do not need to run jstatd to remotely track your Tomcat.

+4
source

For the record: jstatd does not require X-libraries, it depends only on them with the help of another recommended package. You can do aptitude or apt-get skip the installation of recommended packages and install jstatd without any X11 libraries.

For aptitude go to ➞ Preferences ➞ Install recommended packages automatically. For apt-get see this question on askubuntu .

0
source

All Articles