"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > How to enable remote JMX access using JConsole?

How to enable remote JMX access using JConsole?

Published on 2024-11-04
Browse:510

How to enable remote JMX access using JConsole?

Activating JMX for Remote JConsole Access

Q: How can I activate JMX on a JVM to enable access through jconsole?

A: To enable JMX for remote access using jconsole, follow these steps:

  1. Read relevant documentation: Refer to the official documentation at http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html for detailed information.
  2. Start JVM with parameters: Launch your program with the following parameters:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9010
-Dcom.sun.management.jmxremote.rmi.port=9010
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
  1. Example: For instance, you could start your program like this:
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 Notepad.jar
  1. Note: -Dcom.sun.management.jmxremote.local.only=false is recommended, especially for Ubuntu systems.
  2. Exception handling: If you encounter an issue stating that local RMIs only accept connections from local clients, ensure that -Djava.rmi.server.hostname=127.0.0.1 is also set.
  3. Security consideration: Be aware that setting -Dcom.sun.management.jmxremote.authenticate=false allows anyone to access your JVM remotely. Consider using it only for local JVM monitoring.
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3