GWT is a very useful programming framework but sometime it’s very difficult to find out how to solve some problems.
One of the is related to GWT-RPC Serialization. GWT-RPC is the canonical way to make AJAX call from GWT Client to GWT Server passing Serializable beans (more details on GWT web site - http://code.google.com/webtoolkit/doc/latest/tutorial/RPC.html).
To pass a bean you have to fulfill the following requirements (from GWT site):
- It implements either Java Serializable or GWT IsSerializable interface, either directly, or because it derives from a superclass that does.
- Its non-final, non-transient instance fields are themselves serializable
- It has a default (zero argument) constructor with any access modifier (e.g. private Foo(){} will work)
Even if you fulfill these requirements may happen that GWT compiler say:
<class name> 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.: instance = <class instance>@<id>
The problem may have different causes. Here his a complete check list to use for solving the problem:
- Verify that the class has a default constructor (without arguments)
- Verify that the class implements Serializable or IsSerializable or implements an Interface that extends Serializable or extends a class that implement Serializable
- Verify that the class is in a client.* package or …
- 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
- 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 the package 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
- 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.
I hope that this help. Please let me know if I miss some check or I wrote something no more valid. This check list is updated for GWT 2.2.

other point – If a class extends abstract class it doesn’t work!
This will kind of seem like an obvious point but… sometimes you get stuck forgetting the most obvious things!
Don’t forget the need to compile with GWT.
I just spent half a day making all kinds of changes to my code that didn’t require it and when I changed a couple of things in the “Shared” package (parallel the Client package) it took me literally hours to figure out that what I was missing was a simple compile.