Monday, July 25, 2022

Re: GWT RPC Serialization Error

Thanks Jens for pointing out the issue. It is working now.

On Saturday, July 23, 2022 at 2:53:30 AM UTC+5:30 Jens wrote:
Your interface has a type parameter with no upper bound so it is effectively Object. Thus GWT does not know which classes to scan because it will not scan every subclass of Object. Either give your type parameter an upper bound using a common interface or create a dummy method in your service interface that returns a dummy class which references all your classes you want to use in your load method. 

abhiy...@gmail.com schrieb am Freitag, 22. Juli 2022 um 15:43:24 UTC+2:
I am using GWT 2.9 and I am getting below error

SEVERE: Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException: Type 'com.xyz.nos.model.NosOptionModel' 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.: instance = com.xyz.nos.model.NosOptionModel@6cad8f33

SEVERE: Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException: Type 'com.xyz.nos.model.NosOptionModel' 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.: instance = com.xyz.nos.model.NosOptionModel@5fc5e111

SEVERE: Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException: Type 'com.xyz.nos.model.NosCaseDetailModel' 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.: instance = com.xyz.nos.model.NosCaseDetailModel@af3642f

SEVERE: Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException: Type 'com.xyz.nos.model.CountryGroupModel' 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.: instance = com.xyz.nos.model.CountryGroupModel@51987007

SEVERE: Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException: Type 'com.xyz.nos.model.NosUser' 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.: instance = com.xyz.nos.model.NosUser@28bbfa7f

I am doing GWT RPC for populating liststore of combobox and getting above exception while performing it from EntryPoint class. All the above classes are Pojo's and all the fields of these classes are Serializable

I have tried all possible solutions given in java - GWT - RPC SerializationException - Stack Overflow

I have defined my service as below 
public interface INamedComboListDataProvider<M> extends RemoteService {
    public List<M> load(String name);
}

I also have checked my serializationWhitelist and it only contain following 25 classes
{class com.google.gwt.user.client.ui.TreeListenerCollection=true, class java.lang.String=true, class com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException=true, class com.google.gwt.user.client.ui.FocusListenerCollection=true, class com.google.gwt.user.client.rpc.RpcTokenException=true, class java.util.LinkedList=true, class java.lang.RuntimeException=false, class com.google.gwt.user.client.ui.LoadListenerCollection=true, class com.google.gwt.user.client.ui.ClickListenerCollection=true, class com.google.gwt.user.client.ui.FormHandlerCollection=true, class java.lang.Throwable=false, class com.google.gwt.user.client.ui.KeyboardListenerCollection=true, class com.google.gwt.user.client.ui.MouseListenerCollection=true, class com.google.gwt.user.client.ui.TabListenerCollection=true, class java.util.Vector=true, class com.google.gwt.user.client.ui.ChangeListenerCollection=true, class com.google.gwt.user.client.ui.ScrollListenerCollection=true, class com.google.gwt.user.client.ui.PopupListenerCollection=true, class com.google.gwt.user.client.ui.MouseWheelListenerCollection=true, class java.util.Arrays$ArrayList=true, class java.lang.Exception=false, class java.util.ArrayList=true, class java.util.Collections$EmptyList=true, class java.util.Collections$SingletonList=true, class com.google.gwt.user.client.ui.TableListenerCollection=true}

I also have added project folder structure in attachment.
Can anybody guide me where I am going wrong and why does the serializationwhilteList does not contain the pojo models ?


--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/317e03b5-c6c2-4e61-ad2d-6ec4c2edafe2n%40googlegroups.com.

No comments:

Post a Comment