GWT 序列化策略白名单
我有一个 GWT 项目,该项目早些时候正在运行,但已停止运行。
我收到的错误是:
com.google.gwt.user.client.rpc.SerializationException:类型“java.util.ArrayList”未包含在此 SerializationPolicy 可以序列化的类型集中,或者无法加载其 Class 对象。出于安全目的,该类型不会被序列化。
现在 gwt 编译给出了以下输出:
验证可实例化性 dk.web.client.Dummy 分析符合序列化条件的“dk.web.client.Dummy”类型字段 私有 java.util.ArrayList 等 java.util.ArrayList 验证可实例化性 java.util.ArrayList [警告]检查符合序列化条件的所有对象子类型
我在 RPC 服务中使用的所有类上都有零参数构造函数,并且它们都实现了 IsSerializable。
上面的虚拟类包含 RPC 服务中使用的所有类,试图将缺失的类添加到 SerializationPolicy 白名单中。
我可能会错过什么?
谢谢
I have a GWT project which was working earlier on, but have stopped working.
The error I receive is:
com.google.gwt.user.client.rpc.SerializationException: Type 'java.util.ArrayList' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.
Now the gwt compiling gave this output:
Verifying instantiability
dk.web.client.Dummy
Analyzing the fields of type 'dk.web.client.Dummy' that qualify for serialization
private java.util.ArrayList al
java.util.ArrayList
Verifying instantiability
java.util.ArrayList
[WARN] Checking all subtypes of Object which qualify for serialization
I have zero argument constructor on all classes that are use in the RPC service and they all implements IsSerializable.
The dummy class above has all classes used in the RPC service in an attempt to add missing classes to the SerializationPolicy whitelist.
What could I be missing?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你如何实例化你的ArrayList,你给泛型一个类型吗?
例如,不允许
ArrayList
How are you instantiating your ArrayList, are you giving the generic a type?
ArrayList<Object>
for example is not allowed. Where using a serializable object likeArrayList<String>
would be.从 GWT1.4 开始,支持 java.io.Serialized 请参阅此处。您可以尝试让您的类扩展 Serialized 吗?
GWT 有一个针对 ArrayList 的 JRE 模拟,所以我猜它是你的班级有问题。
As of GWT1.4 there has been support for java.io.Serializable see here. Can you try making your classes extend Serializable instead?
GWT has a JRE emulation for ArrayList so I would guess it was a problem with your class.