"Class Type' was not included in the set of types which can be serialized ...

今天做GXT项目遇到这个问题

"Class Type' was not included in the set of types which can be serialized ...

搞了半天没搞清楚原因,好不容易google解决了。

首先,检查自己在web目录下即前台的controller中返回给前台界面代码的bean是继承与gxt model对象的bean。gxt提供了很多种bean model,让你去继承或者实现。

其次,检查这些继承的beanmodel是不是有默认构造函数。

第三,检查这些beanmodel是不是内嵌了list之类的对象,比如gxt提供的Beanmodel这个对象是不支持内嵌list bean

的。除非这个内嵌的list bean对象实现了 BeanModelTag 接口

 

Nested beans are supported when creating BeanModel instances with limited

 * support for nested lists of beans. Any child lists must be defined with

 * java.util.List and must be paramertized with a BeanModelTag class or

 * subclass.

不然很大可能会报NullPoint Exception。

 

最后修正一下,需要检查的步骤:

The problem may have different causes. Here his a complete check list to use for solving the problem:

  1. Verify that the class has a default constructor (without arguments)
  2. Verify that the class implements Serializable or IsSerializable or implements an Interface that extends Serializable or extends a class that implement Serializable
  3. Verify that the class is in a client.* package or …
  4. Verify, if the class is not in client.* package, that is compiled in your GWT xml module definition. By default <source path=”client” /> is present. If your class is in another package you have to add it to source. For example if your class is under domain.* you should add it to xml as <source path=”domain” /> . Be aware that the class cannot belong to server package! More details on GWT page: http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html#DevGuideModuleXml
  5. If you are including the class from another GWT project you have to add the inherits to your xml module definition. For example if your class Foo is in thepackage com.dummy.domain you have to add <inherits name=”com.dummy.domain.Foo”/> to the module definition. More details here: http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html#DevGuideInheritingModules
  6. If you are including the class from another GWT project released as a jar verify that the jar contains also the source code because GWT recompile also the Java source for the classes passed to the Client.

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值