如何解决Jconsole远程连接丢失:重新连接?
我正在尝试使用Java 8 jre(服务器地址:192.168.10.3)对我的tomcat 9进行jconsole远程监视。 在tomcat9w中,我有以下java选项:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=5000
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.local.only=false
-Djava.rmi.server.hostname=192.168.10.3
防火墙关闭。
带有-debug的Jconsole向我显示了这一点:
java.lang.SecurityException: Expecting a sun.rmi.server.UnicastRef2 remote reference in stub!
at java.management.rmi/javax.management.remote.rmi.RMIConnector.checkStub(RMIConnector.java:1787)
at java.management.rmi/javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:310)
at jdk.jconsole/sun.tools.jconsole.ProxyClient.tryConnect(ProxyClient.java:355)
at jdk.jconsole/sun.tools.jconsole.ProxyClient.connect(ProxyClient.java:313)
at jdk.jconsole/sun.tools.jconsole.VMPanel$2.run(VMPanel.java:296)
java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy8.getTotalMemorySize(UnkNown Source)
at jdk.jconsole/sun.tools.jconsole.SummaryTab.formatSummary(SummaryTab.java:261)
at jdk.jconsole/sun.tools.jconsole.SummaryTab$1.doInBackground(SummaryTab.java:87)
at jdk.jconsole/sun.tools.jconsole.SummaryTab$1.doInBackground(SummaryTab.java:85)
at java.desktop/javax.swing.SwingWorker$1.call(SwingWorker.java:304)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.desktop/javax.swing.SwingWorker.run(SwingWorker.java:343)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: javax.management.AttributeNotFoundException: No such attribute: TotalMemorySize
at com.sun.jmx.mbeanserver.PerInterface.getAttribute(UnkNown Source)
at com.sun.jmx.mbeanserver.MBeanSupport.getAttribute(UnkNown Source)
at javax.management.StandardMBean.getAttribute(UnkNown Source)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(UnkNown Source)
at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(UnkNown Source)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(UnkNown Source)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(UnkNown Source)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(UnkNown Source)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(UnkNown Source)
at javax.management.remote.rmi.RMIConnectionImpl.getAttribute(UnkNown Source)
at sun.reflect.GeneratedMethodAccessor95.invoke(UnkNown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(UnkNown Source)
at java.lang.reflect.Method.invoke(UnkNown Source)
at sun.rmi.server.UnicastServerRef.dispatch(UnkNown Source)
at sun.rmi.transport.Transport$1.run(UnkNown Source)
at sun.rmi.transport.Transport$1.run(UnkNown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(UnkNown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(UnkNown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(UnkNown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(UnkNown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(UnkNown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(UnkNown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(UnkNown Source)
at java.lang.Thread.run(UnkNown Source)
at java.rmi/sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:303)
at java.rmi/sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:279)
at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:164)
at jdk.remoteref/jdk.jmx.remote.internal.rmi.PRef.invoke(UnkNown Source)
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl_Stub.getAttribute(UnkNown Source)
at java.management.rmi/javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.getAttribute(RMIConnector.java:904)
at jdk.jconsole/sun.tools.jconsole.ProxyClient$SnapshotInvocationHandler.getAttribute(ProxyClient.java:1011)
at jdk.jconsole/sun.tools.jconsole.ProxyClient$SnapshotInvocationHandler.invoke(ProxyClient.java:984)
at jdk.proxy1/com.sun.proxy.jdk.proxy1.$Proxy1.getAttribute(UnkNown Source)
at java.management/com.sun.jmx.mbeanserver.MXBeanProxy$GetHandler.invoke(MXBeanProxy.java:122)
at java.management/com.sun.jmx.mbeanserver.MXBeanProxy.invoke(MXBeanProxy.java:167)
at java.management/javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:258)
... 10 more
所以我不能告诉我tomcat和java怎么了。 我阅读了tomcat文档,却发现没有任何东西可以帮助我解决此问题。
解决方法
在我的情况下,我尝试针对openjdk-1.11上的VM从openjdk-1.14运行JConsole,并得到相同的错误。
使用其他JDK可以解决问题。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。