服务器启动正常,但发生错误 当我尝试从客户端添加任何工作时,我得到了 跟随错误
java.rmi.MarshalException: error marshalling arguments; nested exception
is:
java.io.NotSerializableException: snaq.db.CacheConnection
at Production_Stub.addGRN(Production_Stub.java:1515)
at ProductionServices.addGRN(ProductionServices.java:21)
at PlanningServices.addGRN(PlanningServices.java:22)
at Planning.addtoGrn(Planning.java:9949)
at Planning.saveAllBundleRelatedTables(Planning.java:9582)
at Planning.savebundlesheet(Planning.java:9251)
at Planning_Skel.dispatch(Planning_Skel.java:6555)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:342)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.io.NotSerializableException: snaq.db.CacheConnection
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1059)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
at Production_Stub.addGRN(Production_Stub.java:1513)
... 14 more
请给我解决方案..
答案 0 :(得分:1)
这里发生的是您尝试通过RMI发送的对象之一是类snaq.db.CacheConnection
的实例,或者(更可能)包含对某个地方的引用。
这不起作用。 CacheConnection
类不可序列化,并且很有可能无法进行序列化。
可能的解决方法是在您尝试发送的类transient
中标记CacheConnection类型的字段(或字段)。