GWT – RPC serialization problem

Type ‘some.type.you.are.sure.is.serializable’ was not included in the set of types that can be serialized by this SerializationPolicy. For security purposes, this type will not be serialized.

One of the most irritating problems that you will probably (sooner or later) have to deal with is GWT serialization policy (or serialization white list). Luckily there are at least 2 ways to work around this issue. Please read GWT documentation and this FAQ first!

If GWT still fails to auto-detect your DTOs or other “go through the wire” objects serialization:

1. Mark your “controversial” objects with com.google.gwt.user.client.rpc.IsSerializable interface This can be a little “ugly” if you want to keep your DTOs clean, without GWT related dependencies… but you can still hack it with
2. Define a new Dummy class with member fields of all types you want to include in serialization. Then add a method to your RPC interface:
Dummy dummy(Dummy d); Add simple implementation:
Dummy dummy(Dummy d) { return d; } And deal with async interface:
void dummy(Dummy d, AsyncCallback callback); From now on the GWT compiler will have no problems with what is or what is not compatible with SerializationPolicy (credits for second solution to Andrej)

You May Also Like