我正在尝试打开与远程机器上运行的 java 应用程序的 JMX 连接。
应用程序 JVM 配置有以下选项:
- com.sun.management.jmxremote
- com.sun.management.jmxremote.port=1088
- com.sun.management.jmxremote.authenticate=false
- com.sun.management.jmxremote.ssl=false
我可以使用 jconsole 或 jvisualvm 使用 localhost:1088
进行连接。
但我无法使用远程机器上的 xxx.xxx.xxx.xxx:1088
进行连接。
服务器之间或操作系统上没有防火墙。但是为了消除这种可能性,我 telnet xxx.xxx.xxx.xxx 1088
并且我认为它可以连接,因为控制台屏幕变为空白。
两台服务器都是 Windows Server 2008 x64。用 64 位 JVM 和 32 位都试过了,都不行。
最佳答案
如果是在 Linux 上,问题将是 localhost 是环回接口(interface),您需要将应用程序绑定(bind)到您的 网络接口(interface)。
您可以使用 netstat 来确认它没有绑定(bind)到预期的网络接口(interface)。
您可以通过使用系统参数 java.rmi.server.hostname="YOUR_IP"
调用程序来完成这项工作,无论是作为环境变量还是使用
java -Djava.rmi.server.hostname=YOUR_IP YOUR_APP
关于java - 远程 JMX 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/834581/