Sami Jmii
Sami Jmii

Reputation: 470

error deserialisation graniteds amf object

When deserialising as3 object to java . GraniteDS throw this Exeption :

java.lang.ClassNotFoundException: org.hibernate.collection.PersistentSet

I think some dependencies should been in pom.xml . any ideas ?

Upvotes: 0

Views: 377

Answers (2)

Sami Jmii
Sami Jmii

Reputation: 470

After debugging , It seems graniteDS (version : 3.1.0.GA) proposes this class as externalizer

org.granite.hibernate.HibernateExternalizer

wich depend on hibernate dependencies :

import org.hibernate.collection.PersistentCollection;
import org.hibernate.collection.PersistentList;
import org.hibernate.collection.PersistentMap;
import org.hibernate.collection.PersistentSet;
import org.hibernate.collection.PersistentSortedMap;
import org.hibernate.collection.PersistentSortedSet;

those dependencies are ok in hibernate versions (3.X) . but the package namespace is no longer valide in hibernate 4 :

import org.hibernate.collection.internal.PersistentBag;
import org.hibernate.collection.internal.PersistentList;
import org.hibernate.collection.internal.PersistentMap;
import org.hibernate.collection.internal.PersistentSet;
import org.hibernate.collection.internal.PersistentSortedMap;
import org.hibernate.collection.internal.PersistentSortedSet;

as a work around : we could define our owen externalizer with the same implementation HibernateExternalizer and change the imports . then we use this custom externalizer in granite-config.xml .

Hoping that graniteDS decouple there implementation from external dependencies that could make breaking change as below .

Upvotes: 0

Zeus
Zeus

Reputation: 6566

GraniteDS does not know anything about the hibernate/any pojos apart from the primitive types and collections when serializing/deserializing. So, in your case even though the library is in place org.hibernate.collection.PersistentSet Granite does not look for it.

Solution:

Create a copy of the hibernate objects for using int graniteDS, so you will have one version for sending the AMF objects and other one dealing with hibernate. Also, it is a good practice to have two copies.

Upvotes: 0

Related Questions