GWT java.util.Date与CustomFieldSerializer的序列化在调试器中失败

GWT java.util.Date与CustomFieldSerializer的序列化在调试器中失败,gwt,serialization,Gwt,Serialization,我对GWT2.4.0序列化日期的方式有一个问题,最简单的解决方案似乎是编写一个Date_CustomFieldSerializer-重载原始实现 但根据我如何启动应用程序,我会得到不同的结果。 令人高兴的是,部署的版本似乎可以顺利工作。另一方面,从Eclipse启动调试会话会导致以下消息: com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: The response could not be deserialize

我对GWT2.4.0序列化日期的方式有一个问题,最简单的解决方案似乎是编写一个Date_CustomFieldSerializer-重载原始实现

但根据我如何启动应用程序,我会得到不同的结果。 令人高兴的是,部署的版本似乎可以顺利工作。另一方面,从Eclipse启动调试会话会导致以下消息:

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)
    ...
Caused by: com.google.gwt.user.client.rpc.SerializationException: java.util.Date/1659716317
    at com.google.gwt.user.client.rpc.impl.SerializerBase.getTypeHandler(SerializerBase.java:153)
我调试了服务器和客户端,服务器正在使用我的序列化程序,客户端在通过其“类型签名”查找序列化程序时失败:
java.util.Date/1659716317

奇怪的是,客户端有一个映射,其中包含
java.util.Date/965047388
的序列化程序

当我使用GWT调试器时,GWT如何创建这些类型签名,以及它们如何不同

--编辑--

我现在知道这些数字是如何产生的。GWT计算层次结构中类名的CRC32哈希(有时也计算方法)


我就是找不到GWT为客户端计算哈希值的地方,以了解为什么它不知道序列化程序,因为它位于CompilingClassLoader和运行时生成的类之间。

客户端没有序列化程序的原因只是GWT无法将其编译为JavaScript(由于意外添加了一些服务器端日志记录引用)


除非您使用“严格”的编译规则,否则这些JavaScript编译会以静默方式失败(或者向编译器输出中添加一行,这会淹没在其他消息中)在你需要它之前,你不会知道你错过了什么。

对于有同样问题的人,我已经收到了几天的错误消息,昨天我找到了原因

我的类路径上有两个不同版本的类Date_CustomFieldSerializer。在我的类路径中添加了一个错误的版本,因为它位于gwt-servlet-2.2.0.jar中,这是我在项目中使用的google gin 1.5库的一个依赖项

我在我的项目中将google gin升级到版本2.1.2,但没有对的gwt servlet依赖项。这样,Date_CustomFieldSerializer类的不同版本不应位于类路径中。如果您有相同的原因,并且不想升级google gin,您可以简单地从google中排除依赖项gwt-servlet-2.2.0pom中的le gin 1.5依赖项。如下所示:

<dependencies>
  <dependency>
    <groupId>sample.ProjectA</groupId>
    <artifactId>Project-A</artifactId>
    <version>1.0</version>
    <scope>compile</scope>
    <exclusions>
      <exclusion>  <!-- declare the exclusion here -->
        <groupId>sample.ProjectB</groupId>
        <artifactId>Project-B</artifactId>
      </exclusion>
    </exclusions> 
  </dependency>
</dependencies>

示例项目a
项目A
1
编译
示例项目B
B项目

这个问题与这篇文章有关吗?我不这么认为,因为我的问题不是随机发生的,它与序列化本身有关,而不是什么对象被序列化。但我会检查我在静态目录中放了什么。
<dependencies>
  <dependency>
    <groupId>sample.ProjectA</groupId>
    <artifactId>Project-A</artifactId>
    <version>1.0</version>
    <scope>compile</scope>
    <exclusions>
      <exclusion>  <!-- declare the exclusion here -->
        <groupId>sample.ProjectB</groupId>
        <artifactId>Project-B</artifactId>
      </exclusion>
    </exclusions> 
  </dependency>
</dependencies>