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

Context menu or Action buttons ?

Recently I was drawn into one of those UI "religious" disputes that has no easy answers and usually both sides are right. One of our web developers was trying out new web tech (with pretty rich widget library) and started to question himself about some basic usability decisions. The low level problem in this case is usually brought to "which widget should I use ?". I'm not fond of bringing the usability problems to questions: Should I use Tabs over Menu ? Or should I use Context menu instead of buttons panel ? But sometimes if time is crucial factor and other usability levels are by default not addressed at all - better developer that asks those basic questions than developer that do not question himself at all.