Search code examples
javaapache-flexblazedsserializableiexternalizable

BlazeDs serialization of Java objects


I have a few Java classes that implements Serialization, and corresponding AS objects (self-generated by GAS) that implements IExternalizable.

There is no problem receiving objects from the server, but when I try to send objects to the server - it throws an exception:

[BlazeDS]Class 'xxx' must implement java.io.Externalizable to receive client 
 IExternalizable instances. flex.messaging.io.SerializationException: Class 'xxx' must  
implement java.io.Externalizable to receive client IExternalizable instances.

Really I must implement Externalizable to send objects to Java server?!


Solution

  • Actually, I don't have to implement Externalizable and even not Serializable. Instead I just have to specify, on the flex side that it is a remote class with alias that points to the full java class path. I should also make sure that the properties names (or getters and setters) are equal to the java object properties names. Finally, I should make sure that the object/properties types are matched or converted well (numeric java objects to Number in Flex etc.).