Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Non serializable objects  RSS feed

 
Andrew Prinoli
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on a java project and I have to serialize a class (created by me) which has many references to other classes that should be serialized too.
I add the marker "implements serializable" to all the necessary classes, but when I run I get a non serializable exception.
Maybe one ore more objects are non serializable, but how do I identify them?
I've read that If I have to serialize non serializable objects, I need to write my own writeObject(ObjectOutputStream out)throws IOException and readObject(ObjectInputStream in) , but I don't know how to implement and us them.
note : I can't use transient beacuse I need everything to be serialized!
Thanks a lot. Bye!
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch.
We try to keep things friendly around here, so we ask that people use their real (or at least a real-sounding) name. Our naming policy is here, but it is basically a first and last name seperated by a space and not obviously fake. You can change your displayed name here.
Thanks.
 
Andrew Prinoli
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Changed...sorry I didn't read it!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Andrew P",

Your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

An initial for your last name is not acceptable.

bear
JavaRanch Sheriff
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!