Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LazyInitializationException during serialization #5

Open
jeansebbaklouti opened this issue Feb 15, 2013 · 2 comments
Open

LazyInitializationException during serialization #5

jeansebbaklouti opened this issue Feb 15, 2013 · 2 comments

Comments

@jeansebbaklouti
Copy link

Hi,

When we serialize an object whith lazy fields, we got some lazyInitialization exceptions

16:21:04 [SimpleAsyncTaskExecutor-1] ERROR o.r.rpc.RawMessageDelegate - Exception occurs during method call
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:186) ~[hibernate-core-4.1.8.Final.jar:4.1.8.Final]
at org.hibernate.collection.internal.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:137) ~[hibernate-core-4.1.8.Final.jar:4.1.8.Final]
at org.hibernate.collection.internal.PersistentBag.size(PersistentBag.java:242) ~[hibernate-core-4.1.8.Final.jar:4.1.8.Final]
at com.caucho.hessian.io.CollectionSerializer.writeObject(CollectionSerializer.java:96) ~[hessian-4.0.7.jar:na]
at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:421) ~[hessian-4.0.7.jar:na]
at com.caucho.hessian.io.UnsafeSerializer$ObjectFieldSerializer.serialize(UnsafeSerializer.java:293) ~[hessian-4.0.7.jar:na]
Wrapped by: java.lang.RuntimeException: could not initialize proxy - no Session
field: fr.parcours4.auth.model.InternalUser.workPlaces
at com.caucho.hessian.io.UnsafeSerializer$ObjectFieldSerializer.serialize(UnsafeSerializer.java:295) ~[hessian-4.0.7.jar:na]
at com.caucho.hessian.io.UnsafeSerializer.writeInstance(UnsafeSerializer.java:212) ~[hessian-4.0.7.jar:na]
Wrapped by: java.lang.RuntimeException: could not initialize proxy - no Session
field: fr.parcours4.auth.model.InternalUser.workPlaces
class: fr.parcours4.auth.model.InternalUser (object=User[Id: 36, Login: login1, Email: user1@test.com])
at com.caucho.hessian.io.UnsafeSerializer.writeInstance(UnsafeSerializer.java:215) ~[hessian-4.0.7.jar:na]
at com.caucho.hessian.io.UnsafeSerializer.writeObject(UnsafeSerializer.java:171) ~[hessian-4.0.7.jar:na]
at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:421) ~[hessian-4.0.7.jar:na]
at com.caucho.hessian.io.AbstractHessianOutput.writeReply(AbstractHessianOutput.java:558) ~[hessian-4.0.7.jar:na]
at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:323) ~[hessian-4.0.7.jar:na]
at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:202) ~[hessian-4.0.7.jar:na]
at org.resthub.rpc.RawMessageDelegate.createResponseBody(RawMessageDelegate.java:162) ~[spring-amqp-hessian-1.0.1-SNAPSHOT.jar:na]
at org.resthub.rpc.RawMessageDelegate.handleMessage(RawMessageDelegate.java:116) ~[spring-amqp-hessian-1.0.1-SNAPSHOT.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_09]

Jean-Sébastien

@sdeleuze
Copy link
Member

@AntoineNeveu
Copy link
Contributor

Pull Request sent using the first solution (custom hibernate serializer) :
#6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants