I have a class which extends treeitem:
import com.google.gwt.user.client.ui.TreeItem;

public class TreeNode extends TreeItem
{
    String id;
    String parentId;
    String type;
    int idx;
    String name;
    String description;
    String code;
//    action is a reserved word
    String operation;
    String target;
    Boolean enabled;

    public TreeNode(String html)
    {
        super(html);
    }


    public String getId()
    {
        return id;
    }

。。。。。。。
}

and write a custom field serializer:
public class TreeNode_CustomFieldSerializer
{
     public static TreeNode instantiate(
                SerializationStreamReader streamReader)
                throws SerializationException
        {
             String html=streamReader.readString();
            return new TreeNode(html);
        }

        public static void serialize(SerializationStreamWriter streamWriter,
                TreeNode instance) throws SerializationException
        {
            streamWriter.writeString(instance.id);
           ....
        }

        public static void deserialize(SerializationStreamReader 
streamReader,
                TreeNode instance) throws SerializationException
        {
            instance.id= streamReader.readString();
           .....
        }
}

and I want to transmit it  between  client and server,but  got  an 
exception:
----------------------------------------------------------------------------------
Caused by: java.lang.ExceptionInInitializerError: null
    at 
com.tsolution.emc.client.gui.tree.TreeNode_CustomFieldSerializer.instantiate(TreeNode_CustomFieldSerializer.java:14)

the Line 14 is:
return new TreeNode(html);

What is this problem?How can I fix it?
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Detailed exception:


[WARN] StandardContext[]An IncompatibleRemoteServiceException was thrown 
while processing this call.
com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: 
java.lang.reflect.InvocationTargetException
   ....
Caused by: com.google.gwt.user.client.rpc.SerializationException: 
java.lang.reflect.InvocationTargetException
   ....
Caused by: java.lang.reflect.InvocationTargetException: null
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  .....
Caused by: java.lang.ExceptionInInitializerError: null
    at 
com.tsolution.emc.client.gui.tree.TreeNode_CustomFieldSerializer.instantiate(TreeNode_CustomFieldSerializer.java:14)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   ........
Caused by: java.lang.UnsupportedOperationException: ERROR: GWT.create() 
is only usable in client code!  It cannot be called, for example, from 
server code.  If you are running a unit test, check that your test case 
extends GWTTestCase and that GWT.create() is not called from within an 
initializer or constructor.
    at com.google.gwt.core.client.GWT.create(GWT.java:91)
 ......
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------




--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to