Search code examples
javahibernategwtgwt-rpcgilead

Are there any other possible reasons for getting a GWT Serialization Policy exception?


I've been poking through this for about a week or so, now, and haven't found anything. I'm building an application with GWT, Hibernate, and Gilead, and I'm attempting to make an rpc call that loads a list of LightEntity objects from the database. This call worked perfectly, right up until I made a minimal change to my rpc interface - I added a deleteLightEntity method. Then I started receiving this error:

Type 'com.blah.shared.DomainObject' 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."

... which is normally characteristic of objects that don't have a no-args constructor, or perhaps don't implement Serializable or IsSerializable. Except my DomainObjects all do. And they all worked properly before I added this method to the rpc. I've even tried removing the method I added and recompiling, and it doesn't seem to work. I have also manually deleted the generated .gwt.rpc files, and cleared my browser cache. If anyone has any idea what could be causing these troubles, I would be very glad to hear it :)


Solution

  • If your class implements Serializable (and not IsSerializable), it will only be included in the serialization policy if it is referenced in the RPC interface, so check that. If you have a reason not to reference that class you could use this workaround.

    Also, since the error mentions the class DomainObject, which I assume is your global superclass, I would try to make it implement Serializable or IsSerializable too (in addition to its subclasses).

    It would also help if you show us some source code.