Jconsole 远程连接丢失:重新连接?

huangapple go评论69阅读模式
英文:

Jconsole remote Connection Lost: Reconnect?

问题

我正在尝试使用jconsole远程监视我的Tomcat 9,使用Java 8 JRE(服务器地址:192.168.10.3)。
在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)
    ...

所以我无法确定我的Tomcat和Java有什么问题。
我阅读了Tomcat文档,但未找到任何可以帮助我解决此问题的信息。

英文:

I'm trying to make a jconsole remote monitoring of my tomcat 9 with java 8 jre (server adress: 192.168.10.3).
In tomcat9w i have this java options:

-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

Firewall is off.

Jconsole with -debug shows me this:

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

So i can't tell what's wrong with my tomcat and java.
I read the tomcat documentation and found nothing there to help me solve this problem.

答案1

得分: 8

在我的案例中,我尝试使用 openjdk-1.14 对 openjdk-1.11 上的虚拟机运行 JConsole,并且遇到了相同的错误。

使用不同的 JDK 解决了这个问题。

英文:

In my case I tried to run JConsole from openjdk-1.14 against a VM on openjdk-1.11 and got the same error.

Using a different JDK did the trick.

huangapple
  • 本文由 发表于 2020年9月27日 23:47:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/64090365.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定