I have an axis2 web service generated in Eclipse with Generate Java Bean Stubs... The web service deploys fine and I am able to send a request (with SoapUI) and can examine the bean object in the debugger. That's all fine!
My problem is that I need to serialize the object and send it to another system running in another JDK instance. I use ObjectOutputStream to serialize the bean and send it over. On the other end I use ObjectInputStream to deserialize the bean but here is the problem, It won't deserialize!
The Beans contain java.util.Calendar objects but they're concrete instances of java.util.GregorianCalendar and deserialization complains that the serialVersionUID is wrong.
Both Tomcat and the deserializing system use the same JDK version.
This is the root cause:
Caused by: java.io.InvalidClassException: java.util.GregorianCalendar; local class incompatible: stream classdesc serialVersionUID = 4557035715945353409, local class serialVersionUID = -8125100834729963327
Perhaps I can serialize the bean as XML? Not sure how to do that though so if someone has an example!
posted 4 years ago
The problem turned out to be that the binary data being sent was getting corrupted and that caused deserialization problems. FIXED it now!