Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RPC Error after GWT 2.3 upgrade

After upgrading to GWT 2.3 some of my RPC services no longer work and fail with "The response could not be deserialized". It seems to happen to services that are returning objects that are use Date objects that are annotated with @Temporal(TemporalType.TIMESTAMP). I use Gilead 1.3.2 and Hibernate 3.6 and I had no issues with GWT 2.2. Any idea what could be going on, or how to start debugging?

Here's the stack trace:

com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: The response could not be deserialized
  at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:221)
  at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java: 287)
  at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
  at sun.reflect.GeneratedMethodAccessor33.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp l.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597) 
  at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
  at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
  at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
  at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
  at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
  at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
  at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
  at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
  at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
  at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
  at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
  at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
  at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
  at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
  at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
  at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
  at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
  at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
  at java.lang.Thread.run(Thread.java:680)
Caused by: com.google.gwt.user.client.rpc.SerializationException: java.sql.Timestamp/1769758459
Caused by: com.google.gwt.user.client.rpc.SerializationException: java.sql.Timestamp/1769758459
  at com.google.gwt.user.client.rpc.impl.SerializerBase.getTypeHandler(SerializerBase.java:153)
  at com.google.gwt.user.client.rpc.impl.SerializerBase.instantiate(SerializerBase.java:114)
  at com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.deserialize(ClientSerializationStreamReader.java:111)
  at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject(AbstractSerializationStreamReader.java:119)
  at com.lensoo.shared.entity.Course_FieldSerializer.deserialize(Course_FieldSerializer.java:320)
  at com.lensoo.shared.entity.Course_FieldSerializer.deserial(Course_FieldSerializer.java:405)
  at com.google.gwt.user.client.rpc.impl.SerializerBase.deserialize(SerializerBase.java:95)
  at com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.deserialize(ClientSerializationStreamReader.java:113)
  at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject(AbstractSerializationStreamReader.java:119)
  at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter$ResponseReader$8.read(RequestCallbackAdapter.java:106) 
  at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:214)
  ... 26 more 
  ... 26 more
like image 851
KevMo Avatar asked May 06 '11 16:05

KevMo


2 Answers

I have very similar problem - Gilead 1.3.1, Hibernate. Exception is also complaining on Timestamp field.

Here's something that I found at Gilead's website:

"Timestamp_FieldSerializer that ships with Gilead conflicts with one that was apparently introduced in GWT 2.2 or 2.3"

http://sourceforge.net/tracker/index.php?func=detail&aid=3285026&group_id=239931&atid=1111398

End of "Details" section suggests the easy fix, however, I haven't tried that yet.

like image 71
Vlad Avatar answered Nov 17 '22 07:11

Vlad


If you don't want to touch JARs - when you use Gilead 1.3.2 as Maven dependecy, there is a better solution I've found today.

Conflicting Gilead serializers must be shadowed by these from GWT 2.3, but as both JARs are on the same level and positioning inherit in gwt.xml doesn't help these must be reimplemented in your project structure. "New" serializers will take precedence both on server and compiled client. Finally you get working GWT 2.3 and Gilead 1.3.2.

In steps:

  1. Create package com.google.gwt.user.client.rpc.core.java.sql in your project.
  2. Using Eclipse open gwt-servlet-2.3.jar and find above package with three files Date_CustomFieldSerializer.class, Time_CustomFieldSerializer.class and Timestamp_CustomFieldSerializer.class. You should see source if Maven downloaded it.
  3. Recreate these source files in your project.

I suppose Gilead team should remove serializers in next release then you delete these from your project as well.

like image 34
gertas Avatar answered Nov 17 '22 07:11

gertas