Thursday, January 6, 2011

Error #2173: Unable to read object in stream


I've been working on building up async tests (which I should have a different post for shortly), and came across this annoying error:

ArgumentError: Error #2173: Unable to read object in stream.  The class com.lordB8r.model.Control does not implement flash.utils.IExternalizable but is aliased to an externalizable class.
at ObjectInput/readObject()
at mx.collections::ArrayList/readExternal()
at mx.collections::ArrayCollection/readExternal()


Finding FlashSecret's comment helped, but didn't get me all the way there.  While I could put the path inside an array, I wasn't assigning the return value to an array, or Control.  Instead, I needed to import a/the class(es) needed by IExternalizable in my test.  So, simply putting this in my test class made it work:

import com.lordB8r.model.Control;


Is this correct for testing?  I'm not sure, but it helped me get my async test to retrieve data from a Spring RESTful service.  Test passed because I got data, but only once I told my test what data type it should be expecting.

I've dealt with this when bootstrapping an application, also when requesting data back from the server.  Often times, my service class (or service recipient) doesn't know the type I just asked for, so I need to import it into that class.

1 comment:

  1. Try adding
    registerClassAlias("package.className", className) method to resolve this issue.

    ReplyDelete