tomcat – 如何修复“无法检索RMIServer存根”JMX错误?

tomcat – 如何修复“无法检索RMIServer存根”JMX错误?
我刚刚完成从 Windows Server 2008 R2到Ubuntu 10.04的迁移.我管理一个有一些性能问题的 Java应用程序( Java 6,Tomcat).我想使用JMX来尝试排除故障,但我似乎无法通过jvisualvm进行连接.

如果我做了ps -ef | grep“java”,我看到以下参数.

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

Netstat显示端口8084正在侦听0.0.0.0.在我的配置中,JMX设置为绑定到服务器的FQDN(我们使用私有DNS服务器).我的防火墙(IPTABLES / UFW)设置为允许所有传出流量,并允许端口8084上的传入流量.

服务器本身是虚拟的,有两个NIC,一个是公共的,一个是私有的.公共NIC的网关已禁用,因此连接只能在私有端进入.

当我尝试使用JMX将jvisualvm连接到我的应用服务器时,我在jvisualvm中收到以下错误.

Cannot connect to [FQDN OMITTED]:8084 using server:jmx:rmi:///jndi/rmi://[FQDN OMITTED]:8084/jmxrmi

如果我查看jvisualvm日志,我会看到以下跟踪.

NFO [com.sun.tools.visualvm.jmx.impl.JmxModelImpl]: connect(service:jmx:rmi:///jndi/rmi://[FQDN OMITTED]:8084/jmxrmi)java.io.EOFException: SSL peer shut down incorrectly                at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:333)                at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:789)Caused: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake                at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:808)                at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1120)                at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:623)                at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)                at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)                at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)                at java.io.DataOutputStream.flush(DataOutputStream.java:106)                at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:211)Caused: java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:                 javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake                at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:286)                at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)                at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)                at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)                at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:97)Caused: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:                 javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake]                at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:101)                at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:185)                at javax.naming.InitialContext.lookup(InitialContext.java:392)                at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1886)                at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1856)                at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:257)Caused: java.io.IOException: Failed to retrieve RMIServer stub                at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:338)                at com.sun.tools.visualvm.jmx.impl.JmxModelImpl$ProxyClient.tryConnect(JmxModelImpl.java:451)[catch] at com.sun.tools.visualvm.jmx.impl.JmxModelImpl$ProxyClient.connect(JmxModelImpl.java:395)                at com.sun.tools.visualvm.jmx.impl.JmxModelImpl.connect(JmxModelImpl.java:216)                at com.sun.tools.visualvm.jmx.impl.JmxModelImpl.<init>(JmxModelImpl.java:205)                at com.sun.tools.visualvm.jmx.impl.JmxModelProvider.createModelFor(JmxModelProvider.java:61)                at com.sun.tools.visualvm.jmx.impl.JmxModelProvider.createModelFor(JmxModelProvider.java:42)                at com.sun.tools.visualvm.core.model.ModelFactory.getModel(ModelFactory.java:111)                at com.sun.tools.visualvm.tools.jmx.JmxModelFactory.getJmxModelFor(JmxModelFactory.java:69)                at com.sun.tools.visualvm.jmx.impl.JmxApplicationProvider.addJmxApplication(JmxApplicationProvider.java:267)                at com.sun.tools.visualvm.jmx.impl.JmxApplicationProvider.createJmxApplication(JmxApplicationProvider.java:185)                at com.sun.tools.visualvm.jmx.JmxApplicationsSupport.createJmxApplicationImpl(JmxApplicationsSupport.java:283)                at com.sun.tools.visualvm.jmx.JmxApplicationsSupport.createJmxApplicationInteractive(JmxApplicationsSupport.java:261)                at com.sun.tools.visualvm.jmx.impl.AddJMXConnectionAction$1.run(AddJMXConnectionAction.java:80)                at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:577)                at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1030)

有没有人有任何想法?

您可以为JMX和RMI对话指定 same port:
-Dcom.sun.management.jmxremote.port=8084 -Dcom.sun.management.jmxremote.rmi.port=8084

推荐阅读