GWT 2.3 升级后出现 RPC 错误
升级到 GWT 2.3 后,我的一些 RPC 服务不再工作并且 失败并显示“响应无法反序列化”。看来 发生在返回使用 Date 的对象的服务上 使用 @Temporal(TemporalType.TIMESTAMP) 注解的对象。我 使用 Gilead 1.3.2 和 Hibernate 3.6,GWT 2.2 没有任何问题。 知道会发生什么,或者如何开始调试吗?
这是堆栈跟踪:
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
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我有非常相似的问题 - Gilead 1.3.1,Hibernate。异常也在时间戳字段上抱怨。
以下是我在 Gilead 网站上发现的内容:
“Gilead 附带的 Timestamp_FieldSerializer 与 GWT 2.2 或 2.3 中明显引入的时间戳冲突”
http://sourceforge.net/tracker/index.php?func=detail&aid=3285026&group_id=239931&atid=1111398
“详细信息”部分末尾建议简单修复,不过,我还没有尝试过。
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.
如果您不想接触 JAR - 当您使用 Gilead 1.3.2 作为 Maven 依赖项时,我今天找到了一个更好的解决方案。
冲突的 Gilead 序列化程序必须受到 GWT 2.3 中这些序列化程序的影响,但由于两个 JAR 都处于同一级别,并且在 gwt.xml 中定位
inherit
并不能帮助这些序列化程序必须在您的项目结构中重新实现。 “新”序列化程序将在服务器和编译的客户端上优先。最后,您可以使用 GWT 2.3 和 Gilead 1.3.2。步骤:
com.google.gwt.user.client.rpc.core.java.sql
。gwt-servlet-2.3.jar
并找到上面的包,其中包含三个文件Date_CustomFieldSerializer.class
、Time_CustomFieldSerializer.class
和Timestamp_CustomFieldSerializer .class
。如果 Maven 下载了源代码,您应该会看到它。我认为吉利德团队应该在下一个版本中删除序列化程序,然后您也从项目中删除它们。
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:
com.google.gwt.user.client.rpc.core.java.sql
in your project.gwt-servlet-2.3.jar
and find above package with three filesDate_CustomFieldSerializer.class
,Time_CustomFieldSerializer.class
andTimestamp_CustomFieldSerializer.class
. You should see source if Maven downloaded it.I suppose Gilead team should remove serializers in next release then you delete these from your project as well.
只需在 [project_path]/war/WEB-INF/lib 上搜索库 json.jar 并将其添加到构建路径即可(我正在使用 Eclipse)。
Simply you can search on [project_path]/war/WEB-INF/lib for the library json.jar and add it to the build path (I'm using Eclipse).
这很简单。您只需从
gilead4gwt-1.3.2.1839.jar
中删除com.google.*
包即可。事实上它确实解决了这个问题。
It's very simple. You just have to deleting the
com.google.*
package from thegilead4gwt-1.3.2.1839.jar
.In fact it does solve this issue.