Re: [jabsorb-user] Re: Grails/Groovy integration with jabsorb

20 views
Skip to first unread message
Message has been deleted
Message has been deleted
Message has been deleted

Raziel Alvarez

unread,
Sep 20, 2009, 9:58:52 PM9/20/09
to jabsor...@googlegroups.com
Do you get any exception?



On Sep 20, 2009, at 7:55 PM, John Cuiuli <jcu...@gmail.com> wrote:

>
> Ok... so I've got further.
>
> I can send anything simple through (int, string etc) but it's choking
> when I try to return a Grails Domain Object. They should be just plain
> beans so I'm confused as to what the problem is.
>
> This is the last bit of the log file... I wonder if the Grails Domain
> Object is reflecting as something else
> (groovy.lang.ExpandoMetaClass)??
>
>
> 2009-09-21 09:42:31,307 [27373743@qtp0-2] DEBUG
> jabsorb.JSONSerializer - search found serializer
> org.jabsorb.serializer.impl.BeanSerializer
> 2009-09-21 09:42:31,307 [27373743@qtp0-2] INFO impl.BeanSerializer -
> analyzing java.util.concurrent.ConcurrentHashMap$Values
> 2009-09-21 09:42:31,309 [27373743@qtp0-2] DEBUG impl.BeanSerializer -
> invoking isEmpty()
> 2009-09-21 09:42:31,309 [27373743@qtp0-2] DEBUG
> jabsorb.JSONSerializer - marshall class java.lang.Boolean
> 2009-09-21 09:42:31,309 [27373743@qtp0-2] DEBUG
> jabsorb.JSONSerializer - looking for serializer -
> java:java.lang.Boolean json:null
> 2009-09-21 09:42:31,309 [27373743@qtp0-2] DEBUG
> jabsorb.JSONSerializer - direct match serializer
> org.jabsorb.serializer.impl.BooleanSerializer
> 2009-09-21 09:42:31,309 [27373743@qtp0-2] DEBUG impl.BeanSerializer -
> invoking getJavaClass()
> 2009-09-21 09:42:31,309 [27373743@qtp0-2] DEBUG impl.BeanSerializer -
> invoking getClassNode()
> 2009-09-21 09:42:31,309 [27373743@qtp0-2] DEBUG
> jabsorb.JSONSerializer - marshall null
> 2009-09-21 09:42:31,309 [27373743@qtp0-2] DEBUG impl.BeanSerializer -
> invoking getExpandoProperties()
> 2009-09-21 09:42:31,309 [27373743@qtp0-2] DEBUG
> jabsorb.JSONSerializer - marshall class java.util.Collections
> $UnmodifiableCollection
> 2009-09-21 09:42:31,309 [27373743@qtp0-2] DEBUG
> jabsorb.JSONSerializer - looking for serializer -
> java:java.util.Collections$UnmodifiableCollection json:null
> 2009-09-21 09:42:31,309 [27373743@qtp0-2] DEBUG
> jabsorb.JSONSerializer - search found serializer
> org.jabsorb.serializer.impl.BeanSerializer
> 2009-09-21 09:42:31,309 [27373743@qtp0-2] INFO impl.BeanSerializer -
> analyzing java.util.Collections$UnmodifiableCollection
> 2009-09-21 09:42:31,310 [27373743@qtp0-2] DEBUG impl.BeanSerializer -
> invoking isEmpty()
> 2009-09-21 09:42:31,312 [27373743@qtp0-2] DEBUG
> jabsorb.JSONRPCServlet - send: {"id":2,"error":{"code":
> 593,"msg":"bean com.beachit.gespm.JobStatus bean
> groovy.lang.ExpandoMetaClass element 0"}}
> 2009-09-21 09:42:31,312 [27373743@qtp0-2] DEBUG
> jabsorb.JSONRPCServlet - send: {
> "error": {
> "code": 593,
> "msg": "bean com.beachit.gespm.JobStatus bean
> groovy.lang.ExpandoMetaClass element 0"
> },
> "id": 2
> }
> 2009-09-21 09:42:31,312 [27373743@qtp0-2] DEBUG
> jabsorb.JSONRPCServlet - not gzipping because size is 114 (less than
> the GZIP_THRESHOLD of 200 bytes)
> 2
> On Sep 21, 7:30 am, sub <sub.cont...@gmail.com> wrote:
>> Hi,
>>
>> RE: Grails/Groovy integration with jabsorb
>>
>> Has anybody tried integrating the two?
>> I'm trying a simple example and am getting weird errors complaining
>> about groovy.lang.ExpandoMetaClass.
>>
>> Error code: 593
>> Message: "bean ]com.beachit.gespm.JobStatus bean
>> groovy.lang.ExpandoMetaClass element 0"
>>
>> It registers fine when I create the RPC object in javascript - it
>> correctly returns the list of functions etc.
>>
>> Here is the snippet I'm using to set up the servlet in grails
>>
>> JSONRPCBridge json_bridge = (JSONRPCBridge)
>> session.getAttribute("JSONRPCBridge")
>>
>> if(json_bridge == null)
>> {
>> json_bridge = new JSONRPCBridge();
>> session.setAttribute("JSONRPCBridge", json_bridge);
>> def jobStatusService = new
>> com.beachit.gespm.JobStatusService()
>>
>> json_bridge.registerObject("jobStatusService",
>> jobStatusService);
>>
>> }
>
> >
Message has been deleted

Michael Clark

unread,
Sep 20, 2009, 10:54:39 PM9/20/09
to jabsor...@googlegroups.com, jcu...@gmail.com
Hi John,

Yes. I think it could be related to the java dynamic 'Proxy' classes.

I have seen problems that might be similar to this when using Hibernate
and lazy loading, jabsorb would choke on the proxy instances - it tries
to reflect on the proxy instead of just the dynamic type (we had a work
around of making sure objects were fetched before passing to jabsorb).

I have not yet studied what these Proxy instances look like when
inspecting them with the reflection API. This happens inside of
BeanSerializer.java and this is most likely where we need to add support
for Proxy instances (my guess of what the problem is).

If you were able to package up a minimal a test case with some
instructions how to run (I don't know what all of the grails
dependancies would be like) then I would be interested to take a look.

Michael.

John Cuiuli wrote:
> Nope - no exception... Just a big long list of groovy objects that the
> serializer is attempting to go through... Something about the dynamic
> nature of Groovy is tripping up the serializer... The log file is full
> of classes that it's trying to go through in an attempt to serialize
> my domain object.
>
> I currently use DWR (www.directwebremoting.org) with my grails
> application and it works fine. I'm looking to migrate to jabsorb - I
> wonder what DWR is doing differently?
>
> On Sep 21, 11:58 am, Raziel Alvarez <raziel...@gmail.com> wrote:
>
>> Do you get any exception?
>>
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages