Enabling JMX Access to a JVM

From NovaOrdis Knowledge Base
Revision as of 20:54, 8 February 2017 by Ovidiu (talk | contribs) (→‎Attach API)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Internal


TODO

Overview

Is this the "remote mode"?

-Dcom.sun.management.jmxremote

More on this and the Attach API (Java 6 and beyond).


Parse and translate http://docs.oracle.com/javase/1.5.0/docs/guide/management/agent.html

Until Java 6, in order to make a JVM accessible to a JMX client, it had to be started with -Dcom.sun.management.jmxremote command line option. A JMX client can access a JVM using a "local mode" (The attach API? Is this what VisualVM uses when attaching to "Local"? or a "remote mode" (see Enabling JMX Access to a JVM below).

Attach API

For Java 6 and beyond, a JMX client can connect using the Attach API. Attach API can only be used by JMX clients that run on the same host. The JMX client needs access to tools.jar that comes with the JDK that runs the target Java process, and also need the PID of the target Java process.

An “attach” playground project that creates a jar that lists the VirtualMachineDescriptor. Document how to run it, document that we need tools.jar.

WildFly and JMX

For specifics on how to attach a generic JMX client to a WildFly instance, see:

WildFly and JMX