Results 1 to 3 of 3
Thread: Serialization problem
- 12-07-2010, 10:58 PM #1
Member
- Join Date
- May 2010
- Posts
- 8
- Rep Power
- 0
Serialization problem
Hi all,
i´m programming a application in a plataform that uses RMI, and when i have to move some information i have this error:
java.rmi.MarshalException: error marshalling arguments; nested exception is:
java.io.NotSerializableException: java.io.PrintWriter
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at java.rmi.server.RemoteObjectInvocationHandler.invo keRemoteMethod(Unknown Source)
at java.rmi.server.RemoteObjectInvocationHandler.invo ke(Unknown Source)
at $Proxy0.moveAgentReceive(Unknown Source)
....
Caused by: java.io.NotSerializableException: java.io.PrintWriter
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.defaultWriteFields(Unkn own Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unk nown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at sun.rmi.server.UnicastRef.marshalValue(Unknown Source)java.rmi.MarshalException: error marshalling arguments; nested exception is:
java.io.NotSerializableException: java.io.PrintWriter
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at java.rmi.server.RemoteObjectInvocationHandler.invo keRemoteMethod(Unknown Source)
at java.rmi.server.RemoteObjectInvocationHandler.invo ke(Unknown Source)
at $Proxy0.moveAgentReceive(Unknown Source)
at BESA.SystemLevel.AdmBESA.moveAgent(AdmBESA.java:28 5)
at Monitor.GuardSolicitarT.funcExecGuard(GuardSolicit arT.java:33)
at BESA.Agent.BehaviorBESA.run(BehaviorBESA.java:80)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.NotSerializableException: java.io.PrintWriter
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.defaultWriteFields(Unkn own Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unk nown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at sun.rmi.server.UnicastRef.marshalValue(Unknown Source)
i´m working in a class that extends another class that implements serializable (io), and the kind of data is String, but the error or serializable is there.
i have tried to put the data static, but the data changes to "NEW"
what can i do for fix this serializable problem?
thanks
- 12-08-2010, 03:15 AM #2
if you have the property in your class that has the PrintWriter type, then try declaring this property as 'transient'. Transient properties are not attempted to be serialized.
Though this usually means you will need to implement your own readObject() to have it set up this property after the object is de-serialized. for example, perhaps PrintWriter is the System.out. or a File output stream kind of thing. How should that get re-initialized after the object has been serialized. I mean, fixing serialization to not try to serialize this object reference to that resource will fix serialization, but without also re-establishing what that object is after deserializing it, the application will still likely have problems.
- 12-09-2010, 08:31 PM #3
Member
- Join Date
- May 2010
- Posts
- 8
- Rep Power
- 0
Similar Threads
-
Serialization
By twiggy62 in forum New To JavaReplies: 2Last Post: 02-12-2010, 04:45 AM -
Serialization
By thayalan in forum Advanced JavaReplies: 4Last Post: 08-03-2009, 10:22 PM -
Serialization
By vijay24805 in forum Threads and SynchronizationReplies: 1Last Post: 04-10-2009, 09:16 PM -
about serialization
By bishnu in forum New To JavaReplies: 0Last Post: 12-19-2008, 09:13 AM -
What is Serialization and de-serialization in Java
By Java Tip in forum java.ioReplies: 0Last Post: 04-04-2008, 02:47 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks