• Post Reply Bookmark Topic Watch Topic
  • New Topic

Axis2 - Serialization of Bean Objects

 
Richard Stollar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Richard Stollar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem turned out to be that the binary data being sent was getting corrupted and that caused deserialization problems. FIXED it now!
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
always nice to see when Topic starter find solution itself

Happy Learning !!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!