我有一个在远程 Linux 服务器上运行的 Java 8 应用程序,需要将 JConsole 附加到它以进行调试。
我从本地计算机设置了到远程计算机的隧道:
ssh -fN -L 9999:localhost:9999 myuser@1.11.11.111
在远程计算机上,我使用以下系统属性运行应用程序:
java -Dcom.sun.management.jmxremote.port=9999 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.local.only=false \
-cp foo.jar:config com.foo.bar.Main config/blah.properties
但是当我启动 JConsole 时,我得到安全连接失败。
如果我点击“不安全连接”,我会得到
我该如何解决这个问题?
最佳答案
我成功地为 RMI 端口添加了一个额外的系统属性,使其正常工作:
java \
-Dcom.sun.management.jmxremote.port=9999 \
-Dcom.sun.management.jmxremote.rmi.port=9999 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.local.only=false \
-cp foo.jar:config com.foo.bar.Main config/blah.properties
关于java - 如何将 JConsole 连接到远程 JVM?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29983262/