Sometimes during inspection of production problems it can be very useful to enable JMX endpoint on running JVM process.
To do this, perform the follow commands as process user.
jcmd <process-id> ManagementAgent.start jmxremote.host=<host-public-ip> jmxremote.port=<custom-port> jmxremote.authenticate=no jmxremote.ssl=no
# Example:
jcmd 5950 ManagementAgent.start jmxremote.host=172.11.2.174 jmxremote.port=9332 jmxremote.authenticate=no jmxremote.ssl=no
To enable JMX with flags during process tartups
java -Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=9010 \
-Dcom.sun.management.jmxremote.local.only=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-jar app.jar