• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Non serializable objects

 
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!
 
Bartender
Posts: 9612
16
Mac OS X Linux 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!
 
Marshal
Posts: 67356
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!