Hi Daniel, That is not the intended behaviour for GWT RPC exception handling. You should be able to throw a subclass of a serializable exception across the wire and it should handle it appropriately.
Having said that, here are a couple of questions to find out why this isn't working in your case: 1) Are you using hosted mode with the embedded Tomcat server, or are you using hosted mode with the -noserver option? If you are using it with the -noserver option, you will need to make sure that you've re-compiled your application with the GWT compiler for it to emit a new <md5>.gwt.rpc serialization policy file, which will contain the newly added ExceptionSubClass. 2) Have you made sure that a default constructor is available in the ExceptionSubClass type? That is, if you've defined a parametrized constructor, the default constructor will no longer be available, which will cause issues when GWT RPC tries to serialize the exception. Hope that helps, -Sumit Chandel On Wed, Apr 15, 2009 at 7:17 AM, daniel.z < [email protected]> wrote: > > I'm experiencing the following behaviour of gwt 1.5.3 when trying to > serialize exceptions via rpc. > > I'v got an self implemented serializable exception type and a subclass > of it like follows: > > public class SerializableRuntimeException extends RuntimeException > implements Serializable { > ... > } > > public class ExceptionSubClass extendsSerializableRuntimeException { > ... > } > > The service interface declares the SerializableRuntimeException as > thrown > > public interface ISyncService extends RemoteService { > public String getSomething() throws > SerializableRuntimeException; > } > > When throwing an SerializableRuntimeException inside the > implementation of getSomething() everything is working as supposed, > but when throwing ExceptionSubClass I just get an > SerializationException on the server which says > > com.google.gwt.user.client.rpc.SerializationException: Type > 'ExceptionSubClass' 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. > > Is it the intended behaviour that gwt only serializes the exact > exception class provided by "throws" and none of its subclasses? Seems > to me like this complicates things. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
