Exception with Serialization in RPC

1 view
Skip to first unread message

Silvia

unread,
Sep 12, 2006, 4:55:30 AM9/12/06
to Google Web Toolkit
Hi,

I'm having problems passing via RPC a Collection with elements
that are objects of a user-defined class that implements
IsSerializable. The class is called "CategoriaVO" and the only data
fields it contains are of types Strings and int.

Here's my service definition:

public interface AniadirGWT extends RemoteService {

/**
* @gwt.typeArgs <ki.rutoteca.gwt.client.CategoriaVO>
*/
public Collection obtenerCategorias();
}

When RPC calls the async callback function it throws a exception:

[WARN] Exception thrown into JavaScript
java.lang.RuntimeException: Checked exception thrown into JavaScript
(web mode behavior may differ)
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNative(ModuleSpaceIE6.java:396)
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNativeVoid(ModuleSpaceIE6.java:283)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:127)
at
ki.rutoteca.gwt.client.AniadirGWT_TypeSerializer.deserialize(transient
source for ki.rutoteca.gwt.client.AniadirGWT_TypeSerializer:177)
at
com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.deserialize(ClientSerializationStreamReader.java:85)
at
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject(AbstractSerializationStreamReader.java:59)
at
ki.rutoteca.gwt.client.AniadirGWT_Proxy$1.onCompletionImpl(transient
source for ki.rutoteca.gwt.client.AniadirGWT_Proxy:54)
at
ki.rutoteca.gwt.client.AniadirGWT_Proxy$1.onCompletionAndCatch(transient
source for ki.rutoteca.gwt.client.AniadirGWT_Proxy:43)
at ki.rutoteca.gwt.client.AniadirGWT_Proxy$1.onCompletion(transient
source for ki.rutoteca.gwt.client.AniadirGWT_Proxy:37)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:90)
Caused by: com.google.gwt.user.client.rpc.SerializationException:
$Proxy399/1697872327
at
ki.rutoteca.gwt.client.AniadirGWT_TypeSerializer.raiseSerializationException(transient
source for ki.rutoteca.gwt.client.AniadirGWT_TypeSerializer:174)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:90)
at
com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:121)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:245)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:154)
at
org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
at
org.eclipse.swt.internal.ole.win32.IDispatch.Invoke(IDispatch.java:64)
at
org.eclipse.swt.ole.win32.OleAutomation.invoke(OleAutomation.java:493)
at
org.eclipse.swt.ole.win32.OleAutomation.invoke(OleAutomation.java:417)
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNative(ModuleSpaceIE6.java:365)


Is there something I don't know about making a class GWT serializable?
I've read the
serialization documentation on the GWT web site but I might be missing
something. Anyone have any ideas? Thanks very much for any help that
you can give me.

Miguel Méndez

unread,
Sep 12, 2006, 2:35:54 PM9/12/06
to Google-We...@googlegroups.com
Hello Silvia,

Based on the stack trace that you provided it appears that you server is sending back a class that the client does not know how to deserialize.  It appears to be some form of an inner class? Something called $Proxy399?

HTH,

On 9/12/06, Silvia <sil...@hotmail.com> wrote:

Hi,

I'm having problems passing via RPC a Collection with elements
that are objects of a user-defined class that implements
IsSerializable. The class is called "CategoriaVO" and the only data
fields it contains are of types Strings and int.

Here's my service definition:

public interface AniadirGWT extends RemoteService {

        /**
         * @gwt.typeArgs <ki.rutoteca.gwt.client.CategoriaVO >
         */
        public Collection obtenerCategorias();
}

When RPC calls the async callback function it throws a exception:

[WARN] Exception thrown into JavaScript
java.lang.RuntimeException : Checked exception thrown into JavaScript
(web mode behavior may differ)
        at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNative(ModuleSpaceIE6.java:396)
        at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNativeVoid (ModuleSpaceIE6.java:283)

        at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:127)
        at
ki.rutoteca.gwt.client.AniadirGWT_TypeSerializer.deserialize(transient
source for ki.rutoteca.gwt.client.AniadirGWT_TypeSerializer:177)
        at
com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.deserialize(ClientSerializationStreamReader.java:85)
        at
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject (AbstractSerializationStreamReader.java:59)

        at
ki.rutoteca.gwt.client.AniadirGWT_Proxy$1.onCompletionImpl(transient
source for ki.rutoteca.gwt.client.AniadirGWT_Proxy:54)
        at
ki.rutoteca.gwt.client.AniadirGWT_Proxy$1.onCompletionAndCatch (transient
source for ki.rutoteca.gwt.client.AniadirGWT_Proxy:43)
        at ki.rutoteca.gwt.client.AniadirGWT_Proxy$1.onCompletion(transient
source for ki.rutoteca.gwt.client.AniadirGWT_Proxy:37)
        at
com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:90)
Caused by: com.google.gwt.user.client.rpc.SerializationException:
$Proxy399/1697872327
        at
ki.rutoteca.gwt.client.AniadirGWT_TypeSerializer.raiseSerializationException (transient
source for ki.rutoteca.gwt.client.AniadirGWT_TypeSerializer:174)
        at
com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:90)
        at
com.google.gwt.dev.shell.ie.IDispatchProxy.invoke (IDispatchProxy.java:121)

        at
com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:245)
        at
com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:154)
        at
org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
        at
org.eclipse.swt.internal.ole.win32.IDispatch.Invoke(IDispatch.java:64)
        at
org.eclipse.swt.ole.win32.OleAutomation.invoke (OleAutomation.java:493)

        at
org.eclipse.swt.ole.win32.OleAutomation.invoke(OleAutomation.java:417)
        at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNative(ModuleSpaceIE6.java:365)


Is there something I don't know about making a class GWT serializable?
I've read the
serialization documentation on the GWT web site but I might be missing
something. Anyone have any ideas? Thanks very much for any help that
you can give me.





--
Miguel

Silvia

unread,
Sep 13, 2006, 4:35:19 AM9/13/06
to Google Web Toolkit
Hello Miguel,

Thanks for your answer but how can I fix the problem?

Silvia

Miguel Méndez

unread,
Sep 13, 2006, 10:07:56 AM9/13/06
to Google-We...@googlegroups.com
Hello Silva,

The '$' in the $Proxy399 binary class name makes me suspect that somehow a local type is being sent back to the client.  Local types cannot be deserialized by the client. 

You will want to find out what instance in the response has a Class.getName() whose value equals or ends in '$Proxy399'.  This will tell you where in the response this local type is coming from.  Then you need to determine if this type is being sent back by design or by mistake.  If it is by design you will need to refactor your solution so that you do not use a local type.  If it is by mistake then you will need to fix the bug.

Hope that helps,
--
Miguel
Reply all
Reply to author
Forward
0 new messages