Friday, July 29, 2011

Re: RPC Serialization

Group is Serializable?

2011/7/29 ph09 <ph.heisig@googlemail.com>
Hey there,

I want to make a RPC Call with an Object called Feature. This class
included an ArrayList with refereces to other Object. So when I do the
RPC Call and want to reach the Object from the ArrayList, i get the
following Eception:

com.google.gwt.user.client.rpc.SerializationException
       at
com.google.gwt.user.client.rpc.impl.SerializerBase.getTypeHandler(SerializerBase.java:
153)
       at
com.google.gwt.user.client.rpc.impl.SerializerBase.serialize(SerializerBase.java:
125)
       at
com.google.gwt.user.client.rpc.impl.ClientSerializationStreamWriter.serialize(ClientSerializationStreamWriter.java:
179)
       at
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:
126)
       at
com.google.gwt.user.client.rpc.core.java.util.Collection_CustomFieldSerializerBase.serialize(Collection_CustomFieldSerializerBase.java:
45)
       at
com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serialize(ArrayList_CustomFieldSerializer.java:
40)
       at
com.google.gwt.user.client.rpc.core.java.util.ArrayList_FieldSerializer.serial(ArrayList_FieldSerializer.java:
23)
       at
com.google.gwt.user.client.rpc.impl.SerializerBase.serialize(SerializerBase.java:
126)
       at
com.google.gwt.user.client.rpc.impl.ClientSerializationStreamWriter.serialize(ClientSerializationStreamWriter.java:
179)
       at
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:
126)
       at
de.fhdo.kuss.client.Feature_FieldSerializer.serialize(Feature_FieldSerializer.java:
51)
       at
de.fhdo.kuss.client.Feature_FieldSerializer.serial(Feature_FieldSerializer.java:
64)
       at
com.google.gwt.user.client.rpc.impl.SerializerBase.serialize(SerializerBase.java:
126)
       at
com.google.gwt.user.client.rpc.impl.ClientSerializationStreamWriter.serialize(ClientSerializationStreamWriter.java:
179)
       at
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:
126)
       at
de.fhdo.kuss.client.SpeicherService_Proxy.test(SpeicherService_Proxy.java:
327)
       at de.fhdo.kuss.client.FM_Gui.test(FM_Gui.java:834)
       at de.fhdo.kuss.client.FM_Gui.<init>(FM_Gui.java:67)
       at de.fhdo.kuss.client.Kuss_Projekt.buildGui(Kuss_Projekt.java:61)
       at de.fhdo.kuss.client.Kuss_Projekt.onModuleLoad(Kuss_Projekt.java:
31)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
       at
com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:
193)
       at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
510)
       at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
352)
       at java.lang.Thread.run(Unknown Source)


Is it because of the ArrayList? Thats my Class:

public class Feature implements Serializable {

       private static final long serialVersionUID = 1L;
       private String name;
       private ArrayList<Group> subgroups = new ArrayList<Group>();
       private String context;

       public Feature(){

       }

       public Feature(String name) {
               this.name = name;
       }

       public String getName() {
               return name;
       }

       public void setName(String name) {
               this.name = name;
       }

       public void addSubgroup(Group group) {
               subgroups.add(group);
       }

       public ArrayList<Group> getSubGroups() {
               return subgroups;
       }
}

And that is my Call:

public void test() {
               AsyncCallback<String> callback = new AsyncCallback<String>() {
                       public void onFailure(Throwable caught) {
                               caught.printStackTrace();
                       }

                       public void onSuccess(String result) {
                               Window.alert(result);

                       }
               };
               Feature feature2 = new Feature("test Feature");
               Feature feature = new Feature("root");
               Group group = new Group(GroupType.mandatory,feature2);
               feature.addSubgroup(group);
               SpeicherService.Util.getInstance().test(feature, callback);
       }

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment