GWT奇怪的序列化异常

时间:2012-04-28 08:21:34

标签: java exception gwt serialization

我有一个应用程序可以计算存储在复杂数据结构中的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(){}都会起作用)我总是这样   忘记零参数常量。当我正在制作一个可序列化的对象   :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) 

1 个答案:

答案 0 :(得分: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以确定是否为什么,如果是,则如何确定它。