如何在Ubuntu Linux中使用JVisualvm监视Tomcat6? [英] How do I monitor Tomcat6 with JVisualvm in Ubuntu Linux?

查看:79
本文介绍了如何在Ubuntu Linux中使用JVisualvm监视Tomcat6?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置JVisualVm来监视Tomcat 6实例(在Ubuntu Server 10.04 LTS上运行).我看过其他问题,但没有一个直接回答我的问题.我尝试使用JVisualvm连接到Tomcat,并且返回无法连接"错误-但是正在与服务器建立TCP连接.短暂的流量爆发后,服务器将断开连接.

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.

我已经将此添加到/etc/default/tomcat6并重新启动了tomcat6

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"

我使用默认设置启动了rmiregistry:

I started rmiregistry using default settings:

rmiregistry &

我还没有开始jstatd;在服务器上安装它需要完整的JDK,它需要X库.我不打算仅仅为了获得一个二进制文件而安装X.

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.

我想知道是否不运行jstatd是否与它有关?我的印象是,只要我可以直接通过JMX端口使用JMX,就不需要RMI或jstatd.

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.

服务器与JVisualvm客户端之间没有防火墙,并且iptables主机防火墙已打开.使用jconsole会导致相同的错误.

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.

在本地Ubuntu 10.04计算机上运行JVisualVM(通过使用其IP地址和JMX端口)并添加JMX实例可以正常工作-尽管监视器显示RMI线程正在运行,但我既未运行rmiregistry也未运行jstatd

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.

问题:为了能够通过JVisualVM通过JMX监视Tomcat(和其他Java程序),我必须做什么(在服务器或客户端上)?

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?

谢谢.

推荐答案

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

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:

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

您无需启动rmiregistry,也无需运行jstatd即可远程监视Tomcat.

You don't need to start rmiregistry and you don't need to run jstatd to be able to monitor your Tomcat remotely.

这篇关于如何在Ubuntu Linux中使用JVisualvm监视Tomcat6?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆