The server starts fine, but the error occurs
when I try to add any job from the Client. I get the
following error
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
What is the solution?
What is going on here is that one of the object that you are trying to send over RMI is an instance of the class
snaq.db.CacheConnection, or (more likely) contains a reference to one somewhere.This ain’t going to work. The
CacheConnectionclass is not serializable, and there’s a good chance that cannot be made serializable.A possible cure for this is to mark the field (or fields) of type CacheConnection in the classes you are trying to send as
transient.