• Post Reply Bookmark Topic Watch Topic
  • New Topic

ObjectIInputStream Throwing EOFException

 
Shekar Atmakur
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
could Someone help me with this exception. this is the code snippet i have that is thowing an EOFException.


the EOF exception occur when i'm creating the instance of the ObjectInputStream.

Any help is appreciated.
thanks,
shekar
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35709
408
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shekar,
Has the format of the object changed since it was in the database? Maybe it is expecting more fields.
 
Shekar Atmakur
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne,
I dont know what you mean by "Format of the Object", but my intention is to recreate the Object as it was stored in the database.
Do i need to do anything else before trying to reconstruct the Object from the database?

thanks,
shekar
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Shekar Atmakur:
I dont know what you mean by "Format of the Object",


If you serialized an object to a database then added a field or made some other change to the object, the serialized version will no longer match the object specification and an attempt to read it out of the database will fail.
The documentation for ObjectInputStream has some information on diagnosing the cause of an exception. My guess is that the field in the database is null. The output stream writes a header to the stream to identify it as a serialized object. The input stream tries to read the header when you call the constructor and if it doesn't exist, will throw an EOF exception.
[ June 16, 2005: Message edited by: Joe Ess ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!