GWT开发模式和外部服务器的间歇序列化异常 [英] Intermitant serialization exception with GWT Dev mode and external server

查看:264
本文介绍了GWT开发模式和外部服务器的间歇序列化异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个GWT应用程序,它在开发模式下与GWT的嵌入式码头服务器非常完美地运行。

然而,我需要转移到使用外部码头服务器(由于各种原因)。我遵循GWT文档编译&完全调试外部服务器设置。



我的应用程序正在运行,但是在加载时的2/3时间内,我得到了一个类似于此的序列化异常(在服务器端):



com.google.gwt.user.client.rpc.SerializationException:类型'my.package.impl.ContentTypeImpl'不能分配给'com。 google.gwt.user.client.rpc.IsSerializable'并没有自定义字段序列化程序。出于安全性考虑,这种类型不会被序列化:instance = my.package.impl.ContentTypeImpl@5e5edf72



我确信这个特定的类是可序列化的,并且我确保我编译了我的应用程序并将静态资产移动到了我的外部服务器war目录中。就像我说的那样,它大约每三次刷新一次浏览器。



有什么建议?



谢谢!

解决方案

from: http://www.gwtproject.org/doc/latest/tutorial/RPC.html#serialize



如果一个类满足以下三个要求,那么它是可序列化的:


  1. 它实现了Java可序列化或GWT IsSerializable
    接口,要么是直接的,要么是因为它来自超类
    。 < -

  2. 它的非最终非瞬时实例字段本身是
    可序列化的,并且它有一个默认的(零参数)带有任何访问权限的构造函数
    修饰符(例如private Foo(){}将会工作


I have a GWT app which runs pretty much flawlessly in Dev mode with GWT's embedded jetty server.

However, I need to move over to using an external jetty server (For various reasons). I followed the GWT documentation Compile & Debug for external server setup exactly.

My app runs, however 2/3 of the time on load I get a serialization exception similar to this (On the server side):

com.google.gwt.user.client.rpc.SerializationException: Type 'my.package.impl.ContentTypeImpl' was not assignable to 'com.google.gwt.user.client.rpc.IsSerializable' and did not have a custom field serializer.For security purposes, this type will not be serialized.: instance = my.package.impl.ContentTypeImpl@5e5edf72

I am sure that this particular class is serializable, and I have ensured that I compiled my application and moved the static assets into my external servers war directory. Like I said, it works about every third time I refresh the browser.

Any suggestions?

Thanks!

解决方案

from: http://www.gwtproject.org/doc/latest/tutorial/RPC.html#serialize

A class is serializable if it meets these three requirements:

  1. It implements either Java Serializable or GWT IsSerializable interface, either directly, or because it derives from a superclass that does. <--
  2. Its non-final, non-transient instance fields are themselves serializable, and
  3. It has a default (zero argument) constructor with any access modifier (e.g. private Foo(){} will work

这篇关于GWT开发模式和外部服务器的间歇序列化异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆