在本地运行进程上调用jmx操作

时间:2013-04-29 14:13:40

标签: jmx jconsole mbeans

我在linux服务器上有一个java进程,使用此选项运行:-Dcom.sun.management.jmxremote

所以我不能通过在我的本地电脑上运行的jconsole连接到这个过程(因为没有设置端口和-Dcom.sun.management.jmxremote.ssl = false选项)。

但是,我怎样才能连接到应用程序并在其某些MBean上运行某些操作?这有可能吗?我有一个ssh访问服务器,并能够在服务器上“本地”运行它(但不幸的是不更改选项)

1 个答案:

答案 0 :(得分:0)

根据JMX documentation -Dcom.sun.management.jmxremote 选项

Enables the JMX remote agent and local monitoring via JMX connector published on a private
interface used by jconsole. The jconsole tool can use this connector if it is executed by 
the same user ID as the user ID that started the agent. No password or access files are 
checked for requests coming via this connector.

命名有点不幸,因为它实际上只能启用本地监控。

由于您无法更改选项但可以通过SSH访问服务器,唯一的选择是使用X服务器转发( ssh -X ... )并运行 jconsole (或者更好的是 jvisualvm ,它具有远程运行的特定优化)。

相关问题