3

我有一个应用程序可以计算 9 个统计信息,这些统计信息存储在复杂的数据结构中,HashMap<String, TreeMap<String, Integer>>甚至更复杂。每个统计都实现接口 IStatistic。结果存储在List<IStatistic>其中,其大小(最大示例)为 3.5MB(我已手动对其进行序列化并将其放入文件中)。当我有时向客户端发送结果时(通常当数据大小超过 1.5MB 时,即当小于某个限制异常时不会发生)奇怪的异常发生并且它永远不会在同一个地方..

我已经阅读并尝试了针对我在此处和 GWT 官方页面上找到的问题的所有类似解决方案,例如:

" https://developers.google.com/web-toolkit/doc/latest/tutorial/RPC http://stackoverflow.com/questions/2122798/gwt-occasional-com-google-gwt-user-client-rpc- serializationexception 你检查 了http://code.google.com/webtoolkit/doc/latest/tutorial/RPC.html#serialize 文章说:它有一个默认的(零参数)构造函数和任何访问修饰符(例如私有 Foo() {} 会工作)我总是忘记 zeroargument const。当我制作可序列化对象时:D“

但没有任何帮助。还尝试对其进行调试,但它在 GWT 源代码中的某处发生故障,我看不到源代码。有趣的是,对于较小的数据样本,一切都很顺利。

我正在使用 GWT 2.4.0。没有应用引擎。

有没有人有类似的问题或有一些建议来处理这个问题?

Here are some example exceptions:
    FIRST EXAMPLE:
    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.GeneratedMethodAccessor52.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        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:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
        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.entry0(Impl.java:213)
        at sun.reflect.GeneratedMethodAccessor32.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        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:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
        at java.lang.Thread.run(Unknown Source)
    Caused by: com.google.gwt.user.client.rpc.SerializationException: 2AS (6) 
        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.google.gwt.user.client.rpc.core.java.util.Map_CustomFieldSerializerBase.deserialize(Map_CustomFieldSerializerBase.java:38)
        at com.google.gwt.user.client.rpc.core.java.util.TreeMap_CustomFieldSerializer.deserialize(TreeMap_CustomFieldSerializer.java:36)
        at com.google.gwt.user.client.rpc.core.java.util.TreeMap_FieldSerializer.deserial(TreeMap_FieldSerializer.java:15)
        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.core.java.util.Map_CustomFieldSerializerBase.deserialize(Map_CustomFieldSerializerBase.java:39)
        at com.google.gwt.user.client.rpc.core.java.util.HashMap_CustomFieldSerializer.deserialize(HashMap_CustomFieldSerializer.java:34)
        at com.google.gwt.user.client.rpc.core.java.util.HashMap_FieldSerializer.deserial(HashMap_FieldSerializer.java:19)
        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 hr.fer.zesoi.metals.shared.statistic.result.StatisticM1Result_FieldSerializer.deserialize(StatisticM1Result_FieldSerializer.java:29)
        at hr.fer.zesoi.metals.shared.statistic.result.StatisticM1Result_FieldSerializer.deserial(StatisticM1Result_FieldSerializer.java:51)
        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.core.java.util.Collection_CustomFieldSerializerBase.deserialize(Collection_CustomFieldSerializerBase.java:34)
        at com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.deserialize(ArrayList_CustomFieldSerializer.java:34)
        at com.google.gwt.user.client.rpc.core.java.util.ArrayList_FieldSerializer.deserial(ArrayList_FieldSerializer.java:19)
        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



SECOND EXAMPLE:
com.google.gwt.dev.shell.HostedModeException: Something other than an int was returned from JSNI method '@com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader::readInt()': JS value of type string, expected int
    at com.google.gwt.dev.shell.JsValueGlue.getIntRange(JsValueGlue.java:266)
    at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:144)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeInt(ModuleSpace.java:247)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeInt(JavaScriptHost.java:75)
    at com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.readInt(ClientSerializationStreamReader.java)
    at com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.readString(ClientSerializationStreamReader.java:104)
    at com.google.gwt.user.client.rpc.core.java.lang.String_CustomFieldSerializer.instantiate(String_CustomFieldSerializer.java:37)
    at com.google.gwt.user.client.rpc.core.java.lang.String_FieldSerializer.create(String_FieldSerializer.java:11)
    at com.google.gwt.user.client.rpc.impl.SerializerBase.instantiate(SerializerBase.java:115)
    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.google.gwt.user.client.rpc.core.java.util.Collection_CustomFieldSerializerBase.deserialize(Collection_CustomFieldSerializerBase.java:34)
    at com.google.gwt.user.client.rpc.core.java.util.TreeSet_CustomFieldSerializer.deserialize(TreeSet_CustomFieldSerializer.java:36)
    at com.google.gwt.user.client.rpc.core.java.util.TreeSet_FieldSerializer.deserial(TreeSet_FieldSerializer.java:15)
    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.core.java.util.Map_CustomFieldSerializerBase.deserialize(Map_CustomFieldSerializerBase.java:39)
    at com.google.gwt.user.client.rpc.core.java.util.HashMap_CustomFieldSerializer.deserialize(HashMap_CustomFieldSerializer.java:34)
    at com.google.gwt.user.client.rpc.core.java.util.HashMap_FieldSerializer.deserial(HashMap_FieldSerializer.java:19)
    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 hr.fer.zesoi.metals.shared.statistic.IStatisticResult_FieldSerializer.deserialize(IStatisticResult_FieldSerializer.java:13)
    at hr.fer.zesoi.metals.shared.statistic.result.StatisticM2Result_FieldSerializer.deserialize(StatisticM2Result_FieldSerializer.java:22)
    at hr.fer.zesoi.metals.shared.statistic.result.StatisticM2Result_FieldSerializer.deserial(StatisticM2Result_FieldSerializer.java:40)
    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.core.java.util.Collection_CustomFieldSerializerBase.deserialize(Collection_CustomFieldSerializerBase.java:34)
    at com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.deserialize(ArrayList_CustomFieldSerializer.java:34)
    at com.google.gwt.user.client.rpc.core.java.util.ArrayList_FieldSerializer.deserial(ArrayList_FieldSerializer.java:19)
    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)
    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.GeneratedMethodAccessor37.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    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.entry0(Impl.java:213)
    at sun.reflect.GeneratedMethodAccessor32.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
    at java.lang.Thread.run(Unknown Source)


THIRD EXAMPLE:

    java.lang.NullPointerException
    at java.util.TreeMap.put(Unknown Source)
    at java.util.TreeSet.add(Unknown Source)
    at com.google.gwt.user.client.rpc.core.java.util.Collection_CustomFieldSerializerBase.deserialize(Collection_CustomFieldSerializerBase.java:35)
    at com.google.gwt.user.client.rpc.core.java.util.TreeSet_CustomFieldSerializer.deserialize(TreeSet_CustomFieldSerializer.java:36)
    at com.google.gwt.user.client.rpc.core.java.util.TreeSet_FieldSerializer.deserial(TreeSet_FieldSerializer.java:15)
    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.core.java.util.Map_CustomFieldSerializerBase.deserialize(Map_CustomFieldSerializerBase.java:39)
    at com.google.gwt.user.client.rpc.core.java.util.HashMap_CustomFieldSerializer.deserialize(HashMap_CustomFieldSerializer.java:34)
    at com.google.gwt.user.client.rpc.core.java.util.HashMap_FieldSerializer.deserial(HashMap_FieldSerializer.java:19)
    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 hr.fer.zesoi.metals.shared.statistic.IStatisticResult_FieldSerializer.deserialize(IStatisticResult_FieldSerializer.java:13)
    at hr.fer.zesoi.metals.shared.statistic.result.StatisticM4Result_FieldSerializer.deserialize(StatisticM4Result_FieldSerializer.java:44)
    at hr.fer.zesoi.metals.shared.statistic.result.StatisticM4Result_FieldSerializer.deserial(StatisticM4Result_FieldSerializer.java:66)
    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.core.java.util.Collection_CustomFieldSerializerBase.deserialize(Collection_CustomFieldSerializerBase.java:34)
    at com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.deserialize(ArrayList_CustomFieldSerializer.java:34)
    at com.google.gwt.user.client.rpc.core.java.util.ArrayList_FieldSerializer.deserial(ArrayList_FieldSerializer.java:19)
    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)
    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.GeneratedMethodAccessor47.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    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.entry0(Impl.java:213)
    at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
    at java.lang.Thread.run(Unknown Source) 
4

1 回答 1

2

对于第一个错误,这几乎肯定表明您的服务器和客户端不同步,并且对可以序列化和反序列化的内容有不同的看法。清除浏览器缓存,或确保服务器运行与客户端相同的代码(如果从 google 的 appengine 服务器运行,则重新部署到服务器,如果在本地运行,则重新部署)。从字符串 " 2AS" 看来,您可能正在混淆类型名称 - 考虑禁用该功能,直到您确定解决此问题。

第二个错误:

com.google.gwt.dev.shell.HostedModeException: Something other than an int was returned from JSNI method '@com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader::readInt()': JS value of type string, expected int
at com.google.gwt.dev.shell.JsValueGlue.getIntRange(JsValueGlue.java:266)
at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:144)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeInt(ModuleSpace.java:247)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeInt(JavaScriptHost.java:75)

幸运的是,这是 Chrome+Dev 模式下的一个已知问题。在其他浏览器中不会出现,在网页模式的Chrome中也不会出现。使用不同的浏览器是避免这种情况的最简单方法——任何运行大量 JSNI 代码(例如任何 RPC 代码)的代码最终都会遇到这种情况。

java.lang.NullPointerException
at java.util.TreeMap.put(Unknown Source)
at java.util.TreeSet.add(Unknown Source)
at com.google.gwt.user.client.rpc.core.java.util.Collection_CustomFieldSerializerBase.deserialize(Collection_CustomFieldSerializerBase.java:35)
at com.google.gwt.user.client.rpc.core.java.util.TreeSet_CustomFieldSerializer.deserialize(TreeSet_CustomFieldSerializer.java:36)
at com.google.gwt.user.client.rpc.core.java.util.TreeSet_FieldSerializer.deserial(TreeSet_FieldSerializer.java:15)

这发生在这段代码中:

@SuppressWarnings("unchecked")
public final class Collection_CustomFieldSerializerBase {

  public static void deserialize(SerializationStreamReader streamReader,
      Collection instance) throws SerializationException {
    int size = streamReader.readInt();
    for (int i = 0; i < size; ++i) {
      Object obj = streamReader.readObject();
      instance.add(obj); //line 35
    }
  }

这表明该行为obj空,并且您可能正在向 TreeSet 添加一些空对象(在我想象的 TreeMap 中)。可能值得在该类中设置断点,条件是 obj 为 null 以确定这是否是原因,如果是,如何确定它。

于 2012-04-28T20:50:12.400 回答