Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

serialization problem

Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear friends,

I got a problem about java object serialization. the server resides in tomcat, sending the serialized object to the client which locates the same machine, using the same java version(1.5.02). the server side serialization code snippet is as following:

//writting the binary data to a file to compare with client side
try {
FileOutputStream fo = new FileOutputStream(
ObjectOutputStream so = new ObjectOutputStream(fo);
System.out.println("successful writting OracleCachedRowSet into file /tmp/object.Server");
} catch (Exception e) {

I run the same code to serialize the same object through tomcat(as a servlet) and eclipse, but I got different file(different size), the file size generated by tomcat is bigger than the size generated by eclipse. the most important of all, I can't use eclipse to read the object serialized into the file by tomcat, because the serialVersionUID is different. I guess maybe the locale or encoding is different? but I can't find any place to specify or setting encoding or locale.

any hint will be greatly apprieciated!
Posts: 43027
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you sure that the version of class "objectxxx" (and all classes it references directly or indirectly) is the same on both JVMs?
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Neither Tomcat/Eclipse has anything to do with Serialization. If you are 100% confident about the content written by java code under Tomcat and Eclipse then you definitely need to check the version used by Eclipse and Tomcat. Printing out System.getProperty("java.version") and System.getProperty("java.vm.version") to confirm about the versions.

SerialVersionID cannot be different unless you have different versions. Search your classpath to make sure you don't have the 2 different classes.
[ October 20, 2006: Message edited by: Purushothaman Thambu ]
Tell me how it all turns out. Here is a tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic