flex模块切换时导致对象不正确序列化的解决办法

http://lkfnn.iteye.com/blog/506690
Flex在调用java端方法的时候如果输入参数是java对象就需要序列化,但是当模块切换时如果不同模块使用不同的对象就会导致切换时序列化失败。
它的原因就是在flex的ModuleLoader内部和外部模块域不同导致序列化失败。

错误信息如下:

[RPC Fault faultString="Cannot invoke method 'methodA'." faultCode="Server.ResourceUnavailable" faultDetail="The expected argument types are (com.bizint.agent.model.Staff) but the supplied types were (flex.messaging.io.amf.ASObject) and converted to (null)."]

解决方法:

设置ModuleLoader的applicationDomain属性为当前的applicationDomain:

modualLoader.applicationDomain=ApplicationDomain.currentDomain;

你可能感兴趣的:(java,Blog,Flex)