Not able to Connect a Remote Host to the VisualVM

后端 未结 5 1551
执念已碎
执念已碎 2021-01-31 18:59

I am new to Java and I\'m facing a problem in connecting a Remote Host to the JVisualVM.

I\'ve searched the Internet and followed all the steps mentioned th

5条回答
  •  说谎
    说谎 (楼主)
    2021-01-31 19:33

    Here are the steps to do this:

    1. Launch an ejstatd in your remote host this way (in ejstatd folder): mvn exec:java -Djava.rmi.server.hostname= -Dexec.args="-pr 1099 -ph 1100 -pv 1101" (used for "jstatd" type connection) (only specify -Djava.rmi.server.hostname if the hostname of your remote host does not match with the one you are seeing from your local network)
    2. Launch your Java application with those additional Java parameters: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1102 -Dcom.sun.management.jmxremote.rmi.port=1102 -Djava.rmi.server.hostname= (used for "JMX" type connection) (same remark as the previous point for -Djava.rmi.server.hostname)
    3. Open those 4 ports on your remote host and make them available to your local machine: 1099, 1100, 1101 and 1102
    4. Launch JVisualVM
      1. Right-click on "Remote" > "Add Remote Host..." and enter your remote host name in "Host name" (if you don't use the port 1099, you can change this in the "Advanced Settings")
      2. Right-click on the remote host you've just created > "Add JMX Connection..." and enter ":1102" in "Connection" input, and check "Do not require SSL connection"
      3. Your Java process will appear twice: one from the "jstatd" connection type, and one from the "JMX" connection type.

    Disclaimer: I'm the author of the open source ejstatd tool.

提交回复
热议问题