如何在 Ubuntu Linux 中使用 JVisualvm 监控 Tomcat6?
我正在尝试设置 JVisualVm 来监视 Tomcat 6 实例(在 Ubuntu Server 10.04 LTS 上运行)。我见过其他问题,但没有一个直接回答我的问题。我尝试使用 JVisualvm 连接到 Tomcat,但返回“无法连接”错误 - 但正在与服务器建立 TCP 连接;服务器在短暂的流量爆发后会断开连接。
我已经将其添加到 /etc/default/tomcat6 并重新启动了 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"
我使用默认设置启动了 rmiregistry:
rmiregistry &
我还没有启动 jstatd
;在服务器上安装它需要完整的 JDK,这需要 X 库。我不会仅仅为了获得一个二进制文件而安装 X。
我想知道不运行 jstatd 是否与此有关;我的印象是,我既不需要 RMI,也不需要 jstatd,只要我可以直接通过 JMX 端口使用 JMX 即可。
服务器和 JVisualvm 客户端之间没有防火墙,并且 iptables 主机防火墙打开。使用 jconsole 会导致相同的错误。
在本地 Ubuntu 10.04 计算机上运行 JVisualVM(通过使用其 IP 地址和 JMX 端口)并添加 JMX 实例工作正常 - 而且我既没有运行 rmiregistry
也没有运行 jstatd
-尽管监视器显示 RMI 线程正在运行。
问题:我必须做什么(在服务器或客户端)才能通过 JVisualVM 的 JMX 监视 Tomcat(和其他 Java 程序)?
提前致谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果没有防火墙,请尝试为 Tomcat 设置 java.rmi.server.hostname 系统属性。将其添加到 Tomcat 的 JAVA_OPTS:
您无需启动
rmiregistry
也无需运行jstatd
即可远程监控您的 Tomcat。If there is no firewall, try to set java.rmi.server.hostname system property for your Tomcat. Add this to your Tomcat's JAVA_OPTS:
You don't need to start
rmiregistry
and you don't need to runjstatd
to be able to monitor your Tomcat remotely.郑重声明:
jstatd
不需要 X 库,它仅通过其他一些推荐的包依赖它们。您可以让aptitude
或apt-get
跳过推荐软件包的安装,并在不安装任何 X11 库的情况下安装jstatd
。对于
aptitude
,进入选项➞首选项➞自动安装推荐的软件包。对于apt-get
,请参阅此问题阿斯库本图。For the record:
jstatd
does not require X libraries, it only depends on them via some other recommended package. You can makeaptitude
orapt-get
skip installation of recommended packages and havejstatd
installed without any X11 libraries.For
aptitude
, go into options ➞ preferences ➞ Install recommended packages automatically. Forapt-get
, see this question on askubuntu.