-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 连接地址 <HOSTNAME>:9998
成功连接到该 JMX 服务器。
但是,当我在 Windows Subsystem for Linux 2 (WSL2) 中运行该应用程序时,Visual VM 无法连接到 localhost:9998
:
连接失败
据我所知,WSL2 中应用程序监听的每个端口也都在主机机器上开放了(Windows 本身),我可以使用 Win+R -> cmd -> telnet localhost 9998
来检查(连接成功)。
此外,我在 WSL2 中正在运行 nginx 实例,我可以通过其它任何浏览器在主机机器上(Windows)使用 localhost
进行访问。