JMX 参数正确传递但无法使用 jconsole 连接

JMX parameters correctly passed but couldn't connect using jconsole

我已经在 java 程序中传递了以下 jmx 参数,并将其部署到某个远程机器上。

-Dcom.sun.management.jmxremote.port=5001 
-Dcom.sun.management.jmxremote.authenticate=false 
-Dcom.sun.management.jmxremote.ssl=false

仍然当我尝试在 jconsole 中使用 host:port 连接到主机时,它会将我重定向到 InsecureConnection 然后它没有连接。

添加

-Dcom.sun.management.jmxremote.host=<hostname>  
-Dcom.sun.management.jmxremote.rmi.port=<pornNum>

当您仅指定 -Dcom.sun.management.jmxremote.port 时,它会将 rmi 注册表绑定到该端口。此注册表包含远程对象,您应该添加 -Dcom.sun.management.jmxremote.rmi.port 以指定绑定该远程对象的位置。 否则将使用随机端口,如果你有防火墙,那就不好了。 您可以查看sun.management.jmxremote.ConnectorBootstrap#startRemoteConnectorServer了解更多详情