Sunday, August 22, 2010

GWT error: 'samples.gwt.Model' is not assignable to 'com.google.gwt.user.client.rpc.IsSerializable' or 'java.io.Serializable' nor does it have a custom field serializer (reached via samples.gwt.Model)


This could really be because of multiple reasons and i have listed solution pertaining to my case here.

See if the class in err i.e. (samples.gwt.Model here) implements
java.io.Serializable; 


i did and this solved the prob in my case. If err still persists, before further analysis you could ensure that following are intact though these might not be directly related.

  Make sure the class (samples.gwt.Model here) that could not be assigned to RPC is defined in shared package (per GWT convention it is the package with leaf folder in name of 'shared' for eg. 'samples.gwt.shared') that's visible to both server and client.
The point is the class should not only be defined in client package (say samples.gwt.client) that's translated to javascript finally and not visible to server part.
(and as a note, you should/would have mentioned this path in corresponding module definition XML as <source path='shared'/>)

 Also if the class in err i.e. is defined in GWT module A (say) and the RPC service class in error is one that's present in module B (say), in this case, ensure that module A is inherited in module B XML definition
via inherit tag.
eg. 
<inherits name='samples.gwt.A'/>

Hope this helps.


No comments:

Post a Comment