RPC: Error when deserialize a Set

24 views
Skip to first unread message

thangenius

unread,
Jun 8, 2006, 5:41:01 AM6/8/06
to Google Web Toolkit
When making a RPC, GWT cannot deserialize a Set (HashSet as
implementation). In MyBean class, I declare a Set of MyCustomType:

public class MyBean {
/**
* @gwt.typeArgs <mypackage.CampaignAssignment>
*/
Set assignments;

public MyBean() {
assignment = new HashSet();
}
}

When making a RPC and pass this bean as a parameter, the following
error occurs:

[WARN] StandardContext[]Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException:
java.lang.reflect.InvocationTargetException
at
com.google.gwt.user.server.rpc.ServerSerializationStream.deserizeWithCustomSerializer(ServerSerializationStream.java:589)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.deserialize(ServerSerializationStream.java:512)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.readObject(ServerSerializationStream.java:443)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.deserializeValue(ServerSerializationStream.java:411)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.deserializeClass(ServerSerializationStream.java:468)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.deserialize(ServerSerializationStream.java:519)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.readObject(ServerSerializationStream.java:443)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.deserializeValue(ServerSerializationStream.java:411)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:290)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:186)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
Caused by: java.lang.reflect.InvocationTargetException: null
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.deserizeWithCustomSerializer(ServerSerializationStream.java:572)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.deserialize(ServerSerializationStream.java:512)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.readObject(ServerSerializationStream.java:443)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.deserializeValue(ServerSerializationStream.java:411)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.deserializeClass(ServerSerializationStream.java:468)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.deserialize(ServerSerializationStream.java:519)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.readObject(ServerSerializationStream.java:443)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.deserializeValue(ServerSerializationStream.java:411)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:290)
Caused by: java.lang.NumberFormatException: For input string: "~"
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:447)
at java.lang.Integer.parseInt(Integer.java:497)
at
com.google.gwt.user.client.rpc.SerializationStream.readInt(SerializationStream.java:109)
at
com.google.gwt.user.client.rpc.core.java.util.HashSet_CustomFieldSerializer.deserialize(HashSet_CustomFieldSerializer.java:51)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.deserizeWithCustomSerializer(ServerSerializationStream.java:572)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.deserialize(ServerSerializationStream.java:512)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.readObject(ServerSerializationStream.java:443)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.deserializeValue(ServerSerializationStream.java:411)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.deserializeClass(ServerSerializationStream.java:468)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.deserialize(ServerSerializationStream.java:519)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.readObject(ServerSerializationStream.java:443)
at
com.google.gwt.user.server.rpc.ServerSerializationStream.deserializeValue(ServerSerializationStream.java:411)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:290)

Rudy Jahchan

unread,
Jun 13, 2006, 3:27:38 PM6/13/06
to Google Web Toolkit
We are having the exact same problem. If we create a HashSet and set it
as the set instance, serialization fails with a NumberFormatException.
This occurs whether the set is empty or has content.

It does not occur when the set is set to null. The bean serializes just
fine.

Miguel Méndez

unread,
Jun 14, 2006, 7:50:42 AM6/14/06
to Google-We...@googlegroups.com
This is a bug in the deserialization logic of the serializer for HashSet.  Your experience would be that a null HashSet would be fine but a HashSet instance, empty or not, could be serialized but not deserialized.  We are tracking this now.

Thanks,
--
Miguel Mendez
GWT Engineer

dbev...@gmail.com

unread,
Jun 26, 2006, 2:05:06 PM6/26/06
to Google Web Toolkit
Hi

I have a similar problem to this, except that I only see it in hosted
mode with my services on a separate Tomcat instance. Does that help?

Any idea if/when this will be fixed?

Thanks

Dominic

> ------=_Part_20284_21798085.1150285842506
> Content-Type: text/html; charset=ISO-8859-1
> Content-Transfer-Encoding: quoted-printable
> X-Google-AttachSize: 1001
>
> This is a bug in the deserialization logic of the serializer for HashSet.&nbsp; Your experience would be that a null HashSet would be fine but a HashSet instance, empty or not, could be serialized but not deserialized.&nbsp; We are tracking this now.
> <br><br>Thanks,<br><br><div><span class="gmail_quote">On 6/13/06, <b class="gmail_sendername">Rudy Jahchan</b> &lt;<a href="mailto:rudy.j...@gmail.com">rudy.j...@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> <br>We are having the exact same problem. If we create a HashSet and set it<br>as the set instance, serialization fails with a NumberFormatException.<br>This occurs whether the set is empty or has content.<br><br>It does not occur when the set is set to null. The bean serializes just
> <br>fine.<br><br><br></blockquote></div><br><br clear="all"><br>-- <br>Miguel Mendez<br>GWT Engineer
>
> ------=_Part_20284_21798085.1150285842506--

ste...@gmail.com

unread,
Jul 3, 2006, 7:26:59 AM7/3/06
to Google Web Toolkit
I got the same problem now.

Has the bug been fixed?
where can I get the newest version or night build? is there a CVS to
update source?

regards,
steeven

Miguel Méndez

unread,
Jul 13, 2006, 10:12:34 AM7/13/06
to Google-We...@googlegroups.com
I apologize for the delayed response guys.  This bug will be fixed in the next release of GWT which we are working on as we speak.

Unfortunately, we do not have a CVS repository that is public nor do we release nightly builds at this time though this may change in the future.

Again, sorry for the silence on the line.
--
Miguel
Reply all
Reply to author
Forward
0 new messages