【问题标题】:How to attach JConsole to a remote JVM? [duplicate]如何将 JConsole 附加到远程 JVM? [复制]
【发布时间】:2015-07-11 01:44:04
【问题描述】:

我有一个在远程 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 时,我得到安全连接失败。

如果我点击“不安全的连接”,我会得到

我怎样才能解决这个问题?

【问题讨论】:

    标签: java jconsole


    【解决方案1】:

    我设法让它为 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-22
      相关资源
      最近更新 更多