you should read DevGuideSerializableTypes to understand what's going on: http://tinyurl.com/yk6cfnn
when you somehow refer to the class in the client-app, GWT compiler does (must) include it: your problem is the serialization of the class On Oct 28, 12:19 pm, gwtfanb0y <[email protected]> wrote: > I have encountered an annoying issue with the GWT-Compiler. It seems > that there is some kind of lazy loading of classes which have > 'IsSerializable' implemented. > I have a Model-Class - implementing 'IsSerializable' - like this: > > ----- > package com.xxx.client.model; > > import com.google.gwt.user.client.rpc.IsSerializable; > > public class MyLazyTestModel implements IsSerializable { > > private String test = "test"; > > private static final long serialVersionUID = 2249512603071211875L; > > public MyLazyTestModel(String str) { > test = str; > } > > public MyLazyTestModel() { > } > > public String getTest() { > return test; > }} > > ----- > > When i am now in the ServiceImpl-Class, and i want to add > 'MyLazyTestModel ' to a Map included in an other Model, i get errors > like this: > > ----- > Caused by: com.google.gwt.user.client.rpc.SerializationException: Type > 'com.xxx.client.model.MyTestModel' 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. > at > com.google.gwt.user.server.rpc.impl.StandardSerializationPolicy.validateSerialize > (StandardSerializationPolicy.java:83) > at > com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize > (ServerSerializationStreamWriter.java:591) > at > com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject > (AbstractSerializationStreamWriter.java:129) > at com.extjs.gxt.ui.client.data.RpcMap_CustomFieldSerializer.serialize > (RpcMap_CustomFieldSerializer.java:37) > ... 72 more > ---- > > --- > SCHWERWIEGEND: dispatcher: ERROR: The serialization policy file '/ > myportal/68EC899B83CE3F6734F2C89A84927232.gwt.rpc' was not found; > did you forget to include it in this deployment? > > SCHWERWIEGEND: dispatcher: WARNING: Failed to get the > SerializationPolicy '68EC899B83CE3F6734F2C89A84927232' for > module 'http://localhost/myportal/';a legacy, 1.3.3 compatible, > serialization policy will be used. > You may experience SerializationExceptions as a result. > --- > > Ok, when i add a dummy RPC with MyLazyTestModel as the returntype, the > application is working. > > ----- > void getMyLazyTestModel(AsyncCallback<MyLazyTestModel> async); > ----- > > So i think the compiler is throwing away classes which implements > 'IsSerializable' when they are not really visible for it. Storing > MyLazyTestModel into a Map makes it 'invisible' to the compiler > because the compiler can (or is) not analyze the map correctly. In my > opinion this is wrong, the compiler should add ALL files inside the > Client-Package into the SerializationPolicy, and not only these who > are visible while they are used. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
