File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes serialization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "serialization" Watch "serialization" New topic
Author

serialization

Gautam Sewani
Ranch Hand

Joined: Apr 19, 2002
Posts: 93

Why does the following code throw a NotSerializableException?
It says that ser class is Not Serializable,but ser implements serializable interface,so why is it not serializable?
Paulo Silveira
Ranch Hand

Joined: May 21, 2002
Posts: 32
nice question
Roy Ben Ami
Ranch Hand

Joined: Jan 13, 2002
Posts: 732
this compiles and runs fine for me with no exceptions!
whats jdk are you using?
just as an after thought though you should always close the streams as a good habit. so close the output stream before trying to read from it and then close the input stream too.
Gautam Sewani
Ranch Hand

Joined: Apr 19, 2002
Posts: 93
I m using jdk1.2
What version r u using?
Roy Ben Ami
Ranch Hand

Joined: Jan 13, 2002
Posts: 732
im using 1.4 ... :roll:
weird. tried searching the bug database in sun but they dont have a bug like you mentioned.
however, there are quite a few bugs there related to serialize objects in 1.2, maybe it is just one of them.
try closing the streams like i mentioned and maybe it will help.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I tried it with 1.4 and it works
Gautam Sewani
Ranch Hand

Joined: Apr 19, 2002
Posts: 93
Can anyone please try this on jdk1.2 and see wether this works or not?
 
 
subject: serialization
 
Similar Threads
Serialization problem
regarding Serializable
Serialization in K&B
Getting error while serializing. Please see the following code while produces IOException.
serialization example of kathy siera book(page no-471)