GWT – RPC serialization problem

Type ‘some.type.you.are.sure.is.serializable’ was not included in the set of types which can be serialized by this SerializationPolicy. For security purposes, this type will not be serialized. One of 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 workaround 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 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 the types that you want to be included 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)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.