1 Reply Latest reply on Jun 28, 2006 9:58 AM by Peter Farland

    flex.messaging.io.ArrayCollection not found

    Randomtask
      I have written a Java class that takes an argument of a java Collection, that consists of my custom Java VOs.
      When I call this from Flex 2.0 beta 3 when the class is in my JRun classpath, everything is fine.
      Flex converts the argument to a Collection that Java can understand.

      When I call the same class remotely, I receive an error from Java.
      It seems Flex wraps the ArrayCollection in a flex.messaging.io.ArrayCollection for remote calls.
      Anyone know how to prevent and/or get around this.

      My remote object is defined as:
      <mx:RemoteObject id="GenSQL_StatusReason" destination="SecurityManagerRO" showBusyCursor="true">
      <mx:method name="genSQL_StatusReason"
      result="event.call.resultHandler(event)"
      fault="event.call.faultHandler( event )"/>
      </mx:RemoteObject>

      The Java interface looks like this:
      import java.util.Collection;

      public String genSQL_StatusReason(LifeCycleStatusVO statusVO,
      ReasonVO reasonVO, Collection Teams, Collection Queues){

      etc . . .
        • 1. Re: flex.messaging.io.ArrayCollection not found
          Peter Farland Level 3
          You can stop a channel endpoint from converting java.util.Collection implementations to mx.collections.ArrayCollection (the ActionScript class representation that the client sees) by setting the <serialization> property <legacy-collection> to true:

          <channel-definition ...>
          ...
          <properties>
          <serialization>
          <legacy-collection>true</legacy-collection>
          ...

          However, I'd suggest trying to work with mx.collection.ArrayCollection and try to solve the issues you're having. If a class is not found on the server, check that flex-messaging.jar and flex-messaging-common.are in /WEB-INF/lib. If you're using RMI, then the remote endpoint would also need these classes.

          If a class is not found on the client then you typically ensure you have a dependency to that class in your ActionScript so that it gets compiled into your SWF. For the final release we added a dependency to ArrayCollection in the channels so that all applications would have this class available on the client.