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(
"/tmp/object.Server");
ObjectOutputStream so = new ObjectOutputStream(fo);
so.writeObject(objectxxx);
so.flush();
so.close();
System.out.println("successful writting OracleCachedRowSet into file /tmp/object.Server");
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
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!
Sam