Serialization problem and Servlet

4 views
Skip to first unread message

Masto

unread,
Jun 21, 2007, 8:52:50 PM6/21/07
to Google Web Toolkit
Hi,

I'm facing a problem that i don't how to work around :

I have a servlet with only one service that return an custom
serialzable objet with 2 string on it.


see below the service :
*****************************************************

public class WizardService extends RemoteServiceServlet implements
IWizardService{

public WizardVO getWizardVO(String id) throws Exception {
return new WizardVO();
}
}

*********************************************************

This service is working great (but very useless).

Now, i just add the following line in the method getWizard(..)

Wizard wizard = WizardManager.getInstance().getWizard(id);
This method get an xml file, etc....but nothing else (no client/server
com, etcc)

The method is now :
************************************************************
public WizardVO getWizardVO(String id) throws Exception {
Wizard wizard = WizardManager.getInstance().getWizard(id);
return new WizardVO();
}

Now, see the result :

[WARN] Exception thrown into JavaScript
com.google.gwt.user.client.rpc.SerializationException:
java.lang.NullPointerException/1463492344
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
481)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:
248)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:
113)
at
org.inventime.web.ui.client.rpc.IWizardService_TypeSerializer.instantiate(transient
source for
org.inventime.web.ui.client.rpc.IWizardService_TypeSerializer:106)
at
com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.deserialize(ClientSerializationStreamReader.java:
92)
at
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject(AbstractSerializationStreamReader.java:
61)
at org.inventime.web.ui.client.rpc.IWizardService_Proxy
$1.onCompletionImpl(transient source for
org.inventime.web.ui.client.rpc.IWizardService_Proxy:59)
at org.inventime.web.ui.client.rpc.IWizardService_Proxy
$1.onCompletionAndCatch(transient source for
org.inventime.web.ui.client.rpc.IWizardService_Proxy:45)
at org.inventime.web.ui.client.rpc.IWizardService_Proxy
$1.onCompletion(transient source for
org.inventime.web.ui.client.rpc.IWizardService_Proxy:39)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:
126)


Why this exception ?? I just add a line that doesn't do anything with
serialization, nor javascript. It's the legacy of my app that i want
to migate.

The servlet is in the package server and i use GWT 1.4 and eclipse.

Can someone please help me understand this issue ?

Thanks a lot,

Thomas

Miguel Méndez

unread,
Jun 22, 2007, 8:33:03 AM6/22/07
to Google-We...@googlegroups.com
Hi Masto,

Basically, an NPE is being thrown in your server code and it is being sent back to the client but it can't deserialize the NPE.

I think this stems from having your service method specified to throw Exception.  In this case the proxy code will only be able to handle the GWT serializable subtypes.  However, the server code thinks that since NullPointerException is assignable to Exception it is okay to send it back to the client.  Hence the SerializationException on the client.

HTH,

maestro-donahue

unread,
Aug 9, 2007, 6:13:30 PM8/9/07
to Google Web Toolkit
Thanks, that was very helpful.

On Jun 22, 6:33 am, "Miguel Méndez" <mmen...@google.com> wrote:
> Hi Masto,
>
> Basically, an NPE is being thrown in your server code and it is being sent
> back to the client but it can't deserialize the NPE.
>
> I think this stems from having your service method specified to throw
> Exception. In this case the proxy code will only be able to handle the GWT
> serializable subtypes. However, the server code thinks that since
> NullPointerException is assignable to Exception it is okay to send it back
> to the client. Hence the SerializationException on the client.
>
> HTH,
>

> --
> Miguel

Reply all
Reply to author
Forward
0 new messages