I should correct my post: This problem does not occur accidentally. It occurs when IdClass is String and does not occur when IdClass is Long.
On Mar 7, 3:07 pm, Ali Jalal <[email protected]> wrote: > Hi, > > I see a problem twice in my project. I have these three base > interfaces and class: > > public interface BaseModelServiceAsync<M extends BaseModel<IdClass>, > IdClass extends Serializable> { > > public void load(IdClass id, AsyncCallback<M> callback); > > } > > public interface BaseModelService<M extends BaseModel<IdClass>, > IdClass extends Serializable> extends RemoteService { > > public M load(IdClass id); > > } > > public class BaseModelServiceImpl<M extends BaseModel<IdClass>, > IdClass extends Serializable> extends RemoteServiceServlet > implements BaseModelService<M, IdClass> { > > public M load(IdClass id) { > M model = .... > return model; > } > > } > > and I have these three sub-interfaces and sub-class: > > public interface AuthorServiceAsync extends > BaseModelServiceAsync<AuthorModel, String> { > > } > > public interface AuthorService extends BaseModelService<AuthorModel, > String> { > > } > > public class AuthorServiceImpl extends > BaseModelServiceImpl<AuthorModel, String> implements AuthorService { > > } > > You can see that IdClass is a Generic parameter that extends > java.io.Serializable and I use this Genetic parameter as first > parameter of load method. > > Now, in some ambiguous (!) situations when I call load method for id > '12' in client side, I get this error: > com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: > java.lang.ClassNotFoundException: 12 at > com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:308) > ..... > Caused by: com.google.gwt.user.client.rpc.SerializationException: > java.lang.ClassNotFoundException: 12 at > com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserialize(ServerSerializationStreamReader.java: > 567) > at > com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject(AbstractSerializationStreamReader.java: > 119) > ..... > Caused by: java.lang.ClassNotFoundException: 12 > > It seems that GWT serialization mechanism "fails" when we use generic > parameters in rpc method's arguments and generic parameters extends an > interface (like java.io.Serializable). In previous errors, > serialization mechanism considers '12' (first argumant of load method) > as Class name of first argument of load method. > > Note that this errors will not always occur (for example if we change > 'Author' to 'Book' in above sub-interfaces and sub-class, errors will > disappeared (!)). > > A simple solution for this problem is that we override load method in > sub-interfaces and sub-class and ignore generic advantages, but it is > not so good. > > I want to now that it is some bugs in GWT or it is some mis-usage of > GWT? > > With many thanks. > Ali Jalal -- 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.
