I am facing the same issue.
Any resolution?

--- In flexcoders@yahoogroups.com, "  " <[EMAIL PROTECTED]> wrote:
>
> Any Clues ?
> 
> ---------- Forwarded message ----------
> From: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> Date: Jan 15, 2007 4:57 PM
> Subject: Urgent :: Custom Serialization exception
> To: flexcoders@yahoogroups.com
> 
> I am using Custom Serialization to serialize my Java Object 
(TreeNode class)
> "recursively" to ActionScript.
> But this fails giving the following exception:
> 
> ArgumentError: Error #2004: One of the parameters is invalid.
>     at flash.utils::ObjectInput/readObject()
>     at com.flex.dao::TreeNode/readExternal()
> 
> (mx.messaging.messages::ErrorMessage)#0
>   body = (Object)#1
>   clientId = (null)
>   correlationId = "5D934A88-B385-627D-2445-258088A878CA"
>   destination = ""
>   extendedData = (null)
>   faultCode = "Server.Acknowledge.Failed"
>   faultDetail = "Was expecting 
mx.messaging.messages.AcknowledgeMessage, but
> received null"
>   faultString = "Didn't receive an acknowledge message"
>   headers = (Object)#2
>   messageId = "983E8914-DDAC-1ECA-C02A-2580CCD4A40F"
>   rootCause = (null)
>   timestamp = 0
>   timeToLive = 0
> 
> 
> =====================================================
> The code of "ActionScript" and "Java" TreeNode classes is as under:
> 
> ======= ActionScript ============
> package com.flex.dao
> {
>     import mx.collections.ArrayCollection;
>     import flash.utils.IExternalizable;
>     import flash.utils.IDataInput;
>     import flash.utils.IDataOutput;
>     import mx.controls.Alert;
> 
>     [RemoteClass(alias=" com.java.dao.TreeNode")]
>     public class TreeNode implements IExternalizable
>     {
>         public var name : String;
>         public var id : int;
>         public var type : int;
>         public var children : ArrayCollection;
>         public var data : Object;
> 
>         public function readExternal(input:IDataInput) : void
>         {
>             id = input.readInt();
>             name = input.readUTF();
>             type = input.readInt();
> 
>             var childCount : int = input.readInt();
>             if(childCount != 0)
>             {
>                 children = new ArrayCollection();
>                 for(var i:int = 0; i<childCount;i++)
>                 {
>                     var obj : Object = input.readObject();
>                     children.addItem(obj);
>                 }
>             }
>             var hasData : int = input.readInt();
>             if(hasData != 0)
>                 data = input.readObject();
>         }
> 
>         public function writeExternal(output:IDataOutput) : void
>         {
>             output.writeInt(id);
>             output.writeUTF(name);
>             output.writeInt(type);
>             if(children != null)
>             {
>                 output.writeInt(children.length);
>                 for(var i:int = 0; i<children.length ;i++)
>                     output.writeObject(TreeNode(children.getItemAt
(i)));
>             }
>             else
>                 output.writeInt(0);
>             if(data != null)
>             {
>                 output.writeInt(1);
>                 output.writeObject(data);
>             }
>             else
>                 output.writeInt(0);
>         }
> 
>     }
> }
> 
> 
> ======== Java ==========
> public class TreeNode implements Externalizable
> 
> {
>     public List children; //list of TreeNode
>     public Object data;
> 
> 
>     public TreeNode()
>     {
>     }
> 
>     public TreeNode(int id, String name, int type) {
>         super(id, name, type);
>         children = new ArrayList();
> 
>     }
> 
> 
>     public void addChild(TreeNode child) {
>           children.add(child);
>     }
> 
> 
>     public void writeExternal(ObjectOutput objectOutput) throws 
IOException
>     {
>         objectOutput.writeInt(id);
>         objectOutput.writeUTF(name);
>         objectOutput.writeInt(type);
> 
>         if(children != null && children.size() > 0)
>         {
>             System.out.println(name + " :: "+children.size());
>             objectOutput.writeInt(children.size());
>             for(int i = 0; i< children.size();i++)
>                 objectOutput.writeObject(children.get (i));
>         }
>         else
>             objectOutput.writeInt(0);
>         if(data != null)
>         {
>             objectOutput.writeInt(1);
>             objectOutput.writeObject(data);
>         }
>         else
>             objectOutput.writeInt(0);
>     }
> 
>     public void readExternal(ObjectInput objectInput) throws 
IOException,
> ClassNotFoundException
>     {
>         id = objectInput.readInt();
>         name = objectInput.readUTF();
>         type = objectInput.readInt();
> 
>         int childCount = objectInput.readInt();
>         if(childCount != 0)
>         {
>             children = new ArrayList();
>             for(int i=0; i<childCount; i++)
>                 children.add((TreeNode)objectInput.readObject());
> 
>         }
>         int hasData = objectInput.readInt();
>         if(hasData != 0)
>             data = objectInput.readObject();
> 
>     }
> }
>


Reply via email to