-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Hibernate POJO de-serialization problem
PostPosted: Thu Aug 18, 2005 3:44 pm 
Newbie

Joined: Thu Aug 18, 2005 12:55 pm
Posts: 2
Hello,

I am working on a client/server app where the client retrieves a hibernate pojo by remotely invoking a retrieval
method of a session bean on the server. The problem that I am experiencing stems from an apparent error that occurs
during the deserialization of the resultant object on the client.

Caused by: java.io.InvalidClassException: org.hibernate.collection.AbstractPersistentCollection; local class incompatible: stream classdesc serialVersionUID = 7663409046372276524, local class serialVersionUID = -7982170513654570219

at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:519)

at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)


The Application Configuration is as follows:

JBoss 4.0.2
Java jdk1.5.0_03(Client and Server)
Hibernate 3
Postgres 7.4

It's also worth pointing out that the hibernate libraries are in the classpath of the Client.
Does anyone have a clue about what caused this problem and how to remedy it?
Any advice would be greatly appreciated.


Raoul


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 18, 2005 3:53 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
The compiler inserts a binary id for each .class . Even though object A and object B have the same name and properties, the ids may not be the same under certain situations. Has the interface of the class changed lately? If so, you may have to recompile distributes libs.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 18, 2005 4:00 pm 
Newbie

Joined: Thu Aug 18, 2005 12:55 pm
Posts: 2
The class interfaces are the same on both client and server. In fact, if a non-persistent instance of the the POJO in question is returned(using new), the error doesn't occur. It appears, that Hibernate modifies the byte code of persistent objects, which might be the cause of this problem.

However, I'm performing a pretty basic task so I would be surprised if this issue hasn't already been addressed by the Hibernate community.

Raoul


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 18, 2005 11:02 pm 
Newbie

Joined: Thu Aug 18, 2005 10:47 pm
Posts: 1
Sorry to break it to you but this one of hibernates severe flaws. Basically,
hibernate bungs up the pojos with enhancements which effectively make it impossible to deserialize the object over rmi, since the classloader is expecting the objects in the original untainted form. I wonder if the hibernate team is aware of this issue.


Cheers,

Jake


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 18, 2005 11:20 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Um. Right.

So how exactly do you propose to "fix" this "flaw", without requiring loading the entire database into memory before serializing?

I'm dying to know....


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 18, 2005 11:21 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
To the original poster. Make sure you have the same version of the Hibernate jar on both client and server, and it will all work perfectly. There is no problem deserializing objects as long as you have the hibernate.jar around.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.