• 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

re. serialVersionUID

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Due to the fact that I was unable to continue with my last topic, I have to begin a new one:
Here is the story so far...
Bob Chandler
ranch hand
Member # 64584
posted May 05, 2004 08:01 AM
--------------------------------------------------------------------------------
Hey there Java peeps,
having problems with some code I'm working on... hope you can help.
I have a class that implements Serializable and, therefore has serialVersionUID number when I run serialVer tool. I'm clear about this part.
However, when I run the part of my code which is retrieving a record from the database, I sometimes get an error that reads:
an Exception occurred: Cabin; local class incompatible: stream classdesc serialVersionUID = 3448415719576074304, local class serialVersionUID = -1390977758539970494
If I have created the record in the current session, it runs ok....
Any suggestions?
Bob

--------------------------------------------------------------------------------
Posts: 31 | Registered: Jan 2004 | IP: Logged

Jeanne Boyarsky
bartender
Member # 50496
posted May 05, 2004 06:07 PM
--------------------------------------------------------------------------------
Bob,
Well it's saying that you changed the serialver id. When this id changes, you are stating that the object should not be read in.
Did you change the id on purpose? Are old objects in the database from a previous deployment with a different id?

--------------------------------------------------------------------------------
Posts: 916 | Registered: May 2003 | IP: Logged


ok, Jeanne, I have not changed or even referred directly to the serialver id in my code.
What's this about previous deployment?
I have written methods that retrieve, modify and persist records back to the database (db is nothing fancy, just a folder in the same directory as my other code files)
The data is still there ie. it doesn't disappear between sessions and the relevant classes implement serializable.
Maybe there is something I don't yet know about - but I just want to be able to access my stored data...
 
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
Bob,
If the serialUid is different (which is only possible in different deployments) it signifies that the object being serialized has changed in structure. This would be dangerous to read in, so java throws an exception.
Another problem that can cause similar errors if there is more the one copy of the class around. (even if the two copies are identical) Try checking your classpath/jars to make sure you don't inadvertently have an extra one.
 
Jeanne Boyarsky
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
Moving to this thread so I can close the duplicate:

for some reason, this forum will not let me add a reply to a post that I start....pah!!
so once again I hope that Jeanne picks this up...
Jeanne
I read your post with interest and, on closer inspection, I have found that the records causing the exception were created before I made further development of the class structure.
I have removed the offending data, re-populated the db and the problem seems to have been resolved
Thank you so much for your help.
all the best,
Bob

 
You will always be treated with dignity. Now, strip naked, get on the probulator and hold this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic