我在远程主机上有一个 tomcat 应用程序,需要通过 JConsole 连接它。应用程序以参数开始:
IP=`ifconfig eth0 | grep 'inet addr:' | cut -d ':' -f2 | cut -d ' ' -f1`
-Dcom.sun.management.jmxremote
-Djava.rmi.server.hostname=$IP
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
9999端口已开放,IP
值有效,我检查过。我可以通过 telnet 访问它(telnet <my_host> <my_port>
)。网络统计:
netstat -a | grep LISTEN
tcp 0 0 *:9999 *:* LISTEN
但我无法通过 jconsole 连接它,我总是得到同样的错误:
Connection Failed: Retry?
But netstat -a
显示连接是ESTABLISHED
我尝试了不同的地址:
<my_host>:<my_port>
service:jmx:rmi://<my_host>:<my_port>/jndi/rmi://<my_host>:<my_port>/jmxrmi
service:jmx:rmi:///jndi/rmi://<my_host>:<my_port>/jmxrmi
我也尝试添加文件.../conf/remote.users
and .../remote.acl
并在属性中写入该文件的路径-Dcom.sun.management.jmxremote.password.file
and -Dcom.sun.management.jmxremote.access.file
但没有效果。
当我在本地计算机上部署此应用程序时,我可以通过以下地址连接到它:"localhost:9999"
求助大家,可能是什么问题?