Hi Vitali, thanks for this pointer ;) I found out that indeed the subclass was not contained in the modules source paths by error.
On 19 Apr., 00:00, Vitali Lovich <[email protected]> wrote: > Are you sure the subclass is on the client classpath? If you put the > subclass on the server side it won't work as the GWT compiler won't > see it (& it won't throw any errors if you don't actually use it in > your client-side code that it compiles). > > GWT cannot serialize arbitrary subclasses that it's not seen during > compile time. > > On Sat, Apr 18, 2009 at 5:24 PM, daniel.z > > <[email protected]> wrote: > > > Hi Sumit, > > > i was somehow hoping this is not the intended behaviour. > > I tested the behaviour in webmode after completely compiling the whole > > application. So I guess it is not a problem with hosted mode in any > > kind. I have checked the generated serialization policy file, which > > really does not contain ExceptionSubClass. And i enshured a no-arg > > constructor is available for it. > > > Along with my investigations is found out that RPC checks if a thrown > > exception is an expected one in the RPC.isExpectedException() method. > > This method returns true for all subclasses of an exception declared > > by throws. But as subclasses are not contained in the generated > > serialization policy file the serialization itself failes with an > > SerializationException. > > > It seems to me that for some reason the gwt compiler does not traverse > > the inheritance hierarchy of declared exception classes when > > generating the <md5>.gwt.rpc file. > > > On 17 Apr., 20:17, Sumit Chandel <[email protected]> wrote: > >> 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 -~----------~----~----~----~------~----~------~--~---
