• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ObjectIInputStream Throwing EOFException

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
reply
    Bookmark Topic Watch Topic
  • New Topic