Rpc with transfer object failing

8 views
Skip to first unread message

Montecristo

unread,
Jan 1, 2010, 8:23:05 PM1/1/10
to grails-gwt
Hi,

I'm calling a method from the gwt side passing a transfer object,
which implements IsSerializable and resides in the client package, so
to be compiled into js, also all class properties are of primitive
types.
Follows the stack trace I'm getting:

com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException:
Parameter 0 of is of an unknown type
'com.lazywithclass.client.rpc.ComponentTo'
at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:286)
at com.google.gwt.user.server.rpc.RPC$decodeRequest.call(Unknown
Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall
(CallSiteArray.java:40)
at com.google.gwt.user.server.rpc.RPC$decodeRequest.call(Unknown
Source)
at org.codehaus.groovy.grails.plugins.gwt.GwtController.processCall
(GwtController.groovy:38)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost
(RemoteServiceServlet.java:224)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost
(AbstractRemoteServiceServlet.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke
(CachedMethod.java:86)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1062)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:
926)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:893)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1010)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:
926)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:893)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent
(PogoMetaClassSite.java:66)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent
(AbstractCallSite.java:155)
at org.codehaus.groovy.grails.plugins.gwt.GwtController
$_closure1.doCall(GwtController.groovy:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
(I've cut some lines)
Caused by: java.lang.ClassNotFoundException:
com.lazywithclass.client.rpc.ComponentTo
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.google.gwt.user.server.rpc.RPC.getClassFromSerializedName
(RPC.java:693)
at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:283)

The transfer object is in the rpc package, i've put it there out of
desperation, originally it was in the package where it is used.
I tested the rpc without the parameter and all goes well, I'm tempted
to go the rest-way as Jan Ehrhardt suggested here:
http://groups.google.com/group/grails-gwt/browse_thread/thread/eea5a87a3e251f63/8344754b3943f778?lnk=gst&q=rpc#8344754b3943f778,
but before this I would like to know what I'm doing wrong.
When I was using gwt without grails I used to convert the transfer
object from client to server in the servlet (the *Impl class), now I'm
a bit confused, any ideas?

Thank you in advance

Montecristo

unread,
Jan 7, 2010, 3:50:05 AM1/7/10
to grails-gwt
Hi,

first and only bump.
Is it even possibile to pass a transfer object (pojo) from gwt to a
grails service?
How do you call the server asyncronously when you have to pass a
transfer object?
Thank you in advance

> to go the rest-way as Jan Ehrhardt suggested here:http://groups.google.com/group/grails-gwt/browse_thread/thread/eea5a8...,

Montecristo

unread,
Jan 8, 2010, 11:18:34 AM1/8/10
to grails-gwt
I finally found out what I was doing wrong: async interfaces and data
transfer object should reside in src/java, so to be used by gwt and by
the grails service as well.
Thank you anyway.

Steffen

unread,
Jan 11, 2010, 11:40:39 PM1/11/10
to grails-gwt
Hi Montecristo,

I currently experiementing with grails and gwt, evaluating the options
for getting both layers to talk with each other.

I just followed your post and want to ask whether you may provide a
working example...?

Thanks very much!

Steffen

Montecristo

unread,
Jan 28, 2010, 6:07:57 AM1/28/10
to grails-gwt
Hi,

I'm a bit late, I made a working example, you could find it here:
http://www.lazywithclass.com/code/4/gwt-on-grails
You will find the link to Google projects (where you could download
the sources) at the start of the article.

Reply all
Reply to author
Forward
0 new messages