Add JMXMP listener for an existing Java application

本小妞迷上赌 提交于 2019-12-12 04:17:28

问题


I need to add a JMXMP listener to an existing Java application without changing any code. The classic RMI based protocol doesn't work in the target environment do to firewall restrictions.

In other words: I would like to access the JMX of the process just by adding the jmx_remote-optional to the classpath and some env properties analog to com.sun.management.jmxremote for the RMI connector.

I couldn't find anything in the various docs out there - I managed to use JMXMP in the target env with Tomcat (adding a LifecycleEventListener that reads the port from the config) and another program where I explicitly started the listener.


回答1:


Take a look at my github project JMXMPAgent. Docs are a little light, but the premise is simple.

  1. Clone the repo
  2. Build with mvn clean install
  3. Install the agent into a running JVM using the PID of the target JVM, the desired JMXMP listening port, binding interface and target MBeanServer default domain as in the following example. It assumes a PID and the default JMX domain.

java -jar target/helios-jmxmp-agent-1.0-SNAPSHOT.jar -install 11121 8334:127.0.0.1:DefaultDomain



来源:https://stackoverflow.com/questions/34850410/add-jmxmp-listener-for-an-existing-java-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!