-->
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.  [ 1 post ] 
Author Message
 Post subject: Can not set javassist.util.proxy.MethodHandler field
PostPosted: Sun Jun 07, 2009 1:16 pm 
Newbie

Joined: Fri May 18, 2007 1:25 am
Posts: 7
Hello.

I found several posts and bugs on the subject of javassist proxy but did not find anything resolving my issues... let me explain:


1) I have several pojos with annotation mapping.
2) Some of the fields are marked with lazy loading. Mainly, lookups such as AddressType, or similar.
3) I'm using GraniteDS to communicate with the Flex UI.

When the objects are serialized I get the following exception:"

java.lang.IllegalArgumentException: Can not set javassist.util.proxy.MethodHandler field net.mydomain.core.persistence.model.Addresstype_$$_javassist_230.handler to net.mydomain.core.persistence.model.Addresstype
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:37)
at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:18)
at java.lang.reflect.Field.get(Field.java:358)
at org.granite.messaging.amf.io.util.FieldProperty.getProperty(FieldProperty.java:65)
at org.granite.hibernate.HibernateExternalizer.writeExternal(HibernateExternalizer.java:154)
at org.granite.messaging.amf.io.AMF3Serializer.writeAMF3Object(AMF3Serializer.java:363)
at org.granite.messaging.amf.io.AMF3Serializer.writeObject(AMF3Serializer.java:135)
at org.granite.hibernate.HibernateExternalizer.writeExternal(HibernateExternalizer.java:169)
at org.granite.messaging.amf.io.AMF3Serializer.writeAMF3Object(AMF3Serializer.java:363)
at org.granite.messaging.amf.io.AMF3Serializer.writeObject(AMF3Serializer.java:135)
at org.granite.messaging.amf.io.AMF3Serializer.writeAMF3Array(AMF3Serializer.java:287)
at org.granite.messaging.amf.io.AMF3Serializer.writeObject(AMF3Serializer.java:132)
at flex.messaging.io.ArrayCollection.writeExternal(ArrayCollection.java:60)
at org.granite.messaging.amf.io.AMF3Serializer.writeAMF3Object(AMF3Serializer.java:372)
at org.granite.messaging.amf.io.AMF3Serializer.writeAMF3Collection(AMF3Serializer.java:315)
at org.granite.messaging.amf.io.AMF3Serializer.writeObject(AMF3Serializer.java:127)
at org.granite.messaging.amf.io.AMF3Serializer.writeAMF3Object(AMF3Serializer.java:380)
at org.granite.messaging.amf.io.AMF3Serializer.writeObject(AMF3Serializer.java:135)
at org.granite.messaging.amf.io.AMF0Serializer.writeAMF3Data(AMF0Serializer.java:527)
at org.granite.messaging.amf.io.AMF0Serializer.writeData(AMF0Serializer.java:156)
at org.granite.messaging.amf.io.AMF0Serializer.writeBody(AMF0Serializer.java:142)
at org.granite.messaging.amf.io.AMF0Serializer.serializeMessage(AMF0Serializer.java:104)
at org.granite.messaging.webapp.AMFMessageFilter.doFilter(AMFMessageFilter.java:95)
...

The Hibernate session is still open.

I saw some posts giving the "solution" of not having lazy loading. I understand that this would be a correct handling for this one problem as in this case, I "obviously" don't benefit from lazy loading since I'm sending it all to the client so will read it all...

But that is not totally true either because if I turn off lazy fetching, then it does joins and the queries now always joins to the look up tables, whereas when it is lazy fetched, it uses the caching of the look ups. So I do gain by having it lazy fetched and I would like to retain it.

I also have other processes that are not related to the UI which does benefit from lazy fetching.

I colleague attempted to resolve this problem by implementing a deep copy of the objects before returning them for serialization. That generally works but it's a bit slow on lists of objects.

Is there a way to clean up the objects from the proxy classes? Or any other solution someone may have come up with?


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

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.