java - 从 GWT 应用程序中执行 RPC 时出现 SerializationPolicy 错误

标签 java serialization gwt rpc gwt-rpc

我收到以下异常:

com.google.gwt.user.client.rpc.SerializationException: Type 'java.lang.Long' 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

使用 GWT 2.1 和内置的 Jetty 服务器。根据文档,这种类型绝对是可序列化的......我怎样才能将它包含在 SerializationPolicy 中?

最佳答案

这是应该解决问题的链接: http://developerlife.com/tutorials/?p=131

A user defined class is serializable if:

  1. the class is assignable to IsSerializable or java.io.Serializable, either because it implements one of these interfaces, or because it is derived from a superclass that implements one of these interfaces.
  2. all the class’s non-final, non-transient instance fields are serializable
  3. the class has a public default (zero argument) constructor

关于java - 从 GWT 应用程序中执行 RPC 时出现 SerializationPolicy 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4202964/

相关文章:

java - 自定义反序列化后出现意外的空值

unit-testing - GWT JUnit 测试

java - GWT PopupPanel 未正确显示动画图像

java - 支柱2.3 : Change scope for Action Beans

PHP/MySql 测试应用程序

java - AspectJ 有没有办法从 Before 检索返回值并在切入点内使用它?

java - 关于 Java 的 Serializable,需要澄清

Java GWT在应用自定义celltable/datagrid css样式时如何编写文件路径

java - @MessageMapping 返回上的 STOMP header

java - Java项目中的DSL-Json太慢