我正在尝试查询在 Tomcat WebApplication 中运行的 JMX MBeanServer。我在获取 MBean 的属性列表时看到以下错误
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.catalina.core.StandardContext
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:191)
at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl_Stub.getAttributes(Unknown Source)
at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.getAttributes(RMIConnector.java:927)
我是不是在我的网络应用程序中做错了什么。我已经针对许多其他 Java 应用程序测试了我的 JMX 客户端,但从未遇到过此错误。如果有人已经遇到此异常,将会有所帮助。
编辑:
找到错误
Bean: Catalina:name="ajp-bio-8009",type=ThreadPool
~~~~~
Attributes
.....
maxThreads:200
sSLEnabled:false
keystorePass:null
localPort:8009
connectionCount:1
currentThreadCount:0
keepAliveTimeout:-1
threadPriority:5
keyPass:null
useComet:false
soLinger:-1
sslEnabledProtocolsArray:[Ljava.lang.String;@3d1a70a7
socketProperties:java.rmi.UnmarshalException: error unmarshalling
...
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.tomcat.util.net.SocketProperties
最佳答案
您的getAttributes()
方法返回类型StandardContext
,它既不是Serializable
也不是导出的远程对象。所以当服务器去写返回值时,它引发了一个NotSerializableException.
您似乎在尝试远程获取应用程序上下文或其属性?
关于tomcat Web 应用程序中的 Java RMI UnmarsharledException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20077861/