4

I'm trying to set up JVisualVm to monitor a Tomcat 6 instance (running on Ubuntu Server 10.04 LTS). I've seen other questions, but none of them directly answer my problem. I try to connect to Tomcat with JVisualvm and it comes back with a "Cannot connect" error - but there are TCP connections being made to the server; the server drops the connection after a short burst of traffic.

I have already added this to /etc/default/tomcat6 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 default settings:

rmiregistry &

I haven't started jstatd; installing it on the server requires the full JDK which requires X libraries. I'm not about to install X just to get one single binary.

I wonder if not running jstatd would have something to do with it; I was of the impression that I needed neither RMI nor jstatd, as long as I could use JMX directly via the JMX port.

There is no firewall in 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 (by using its IP address and JMX port) and adding a JMX instance works fine - and I'm running neither rmiregistry nor jstatd - though the monitor shows RMI threads running.

Question: What must I do (either on the server or the client) in order to be able to monitor Tomcat (and other Java programs) via JMX with JVisualVM?

Thanks in advance.

4

2 回答 2

4

如果没有防火墙,请尝试为您的 Tomcat 设置 java.rmi.server.hostname 系统属性。将此添加到您的 Tomcat 的 JAVA_OPTS:

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

您无需启动rmiregistry,也无需运行jstatd即可远程监控您的 Tomcat。

于 2011-06-15T07:51:08.220 回答
0

记录一下:jstatd不需要 X 库,它只依赖于它们通过其他一些推荐的包。您可以制作aptitudeapt-get跳过推荐的软件包的安装,并且在jstatd没有任何 X11 库的情况下安装。

对于aptitude,进入选项 ➞ 首选项 ➞ 自动安装推荐的包。对于apt-get,请参阅askubuntu 上的这个问题

于 2013-03-25T18:18:25.163 回答