2 Replies Latest reply on May 21, 2010 8:59 AM by msakrejda

    BlazeDS serialization resulting in null nested object(s)


      Hello, I am using blazeds remoting to access a single java method that returns a java.util.List of complex object type (let's call the class A).  On class A there are primitive types and nested objects, one of which is a java.util.List of complex object type (let's call this class B).  Again, same thing - class B has primitive types and another java.util.List of class C.  The java.util.List of type A and B (1 and 2 levels deep) successfully get serialized into AS3 ArrayCollection objects.  However, the java.util.List of class C (3 levels deep) is coming through as null.  I have written a java test client class that calls the same method that is being called via blazeds remoting, and have verified that the List of class C is in fact NOT null.  It contains all the objects / data I expect it to.  However, once I'm iterating over the objects in my Flex code it's null.  So, it has to have something to do with the serialization.  Is there possibly a limitation on the depth that blazeds will serialize the java objects?  Any other ideas?  I would greatly appreciate any help!  Thanks!

        • 1. Re: BlazeDS serialization resulting in null nested object(s)
          jasonvangundy Level 1

          Well, I did some more looking on the forums and think I've found the answer.  The List of object type A that was being serialized and returned to Flex via blazeds was a class auto-created by jaxws-ri's wsimport tool.  It automatically created all fields with protected scope, which was apparently causing the problem.  What I don't understand, at all, is why it was only causing a problem with objects nested further within the object structure.  Both the List of object type A and List of object type B were declared as protected as well, but they got serialized fine.  If anyone has a better understanding of this and can help explain I'd still appreciate the insight!

          • 2. Re: BlazeDS serialization resulting in null nested object(s)
            msakrejda Level 4

            Unfortunately, AMF serialization is something of a black art. I'd run into multiple issues in the past (working with Granite DS, rather than Blaze--but it's essentially the same thing). I'm not sure about Blaze, but Granite has very verbose logging available if you configure log4j to DEBUG level for org.granite. The other alternative is to attach to your Java process with a debugger (Eclipse makes this fairly automagical), download the Blaze source and configure Blaze as a project in Eclipse, add it to source lookup for your project, and step through the actual serialization to see what's going on. This is moderately complicated to set up, but priceless when it comes to debugging.