简体   繁体   中英

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 ?

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM