【发布时间】:2021-02-16 10:33:53
【问题描述】:
我正在使用启用 JMX 服务器远程连接的以下参数运行我的 Java 应用程序:
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=9998
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
我可以通过 VisualVM 成功连接到该 JMX 服务器,方法是将新的 JMX 连接添加到地址:<HOSTNAME>:9998
但是当我在 Windows Subsystem for Linux 2 (WSL2) 中运行该应用程序时,Visual VM 无法连接到localhost:9998:
connection failed
据我所知,应用程序在 WSL2 中侦听的每个端口也在主机(Windows 本身)中打开,我可以使用Win+R -> cmd -> telnet localhost 9998(连接成功)来检查。
另外,我在 WSL2 中运行一个 nginx 实例,我可以使用 localhost 连接到我的主机 (Windows) 上的任何浏览器。
【问题讨论】:
标签: java windows-subsystem-for-linux jmx visualvm wsl-2