I have an application using Flex Data Services running from
Tomcat. I've created Java domain objects as well as corresponding
ActionScript objects and everything seems to work fine when I pull
the Java objects to the client using Data Management Services
combined with the Java Adapter and my custom FlexFactory and a
Spring backend. The objects being used have several associations:
(ie. Student object references multiple Course objects which each
reference a Teacher object, etc). With less than 500 rows in each
table (Users, Teachers, Students, Courses, Subjects, etc) things
work fine.
However, when I put a significant number of rows of data into
some of the tables all of a sudden I get an exception on the
server. For example, if I have 100 Teacher rows in my database and
those reference 500 Courses and those reference 1000 Students,
things are fine. But if I put in another 5000 Students, which are
also referenced by these Courses, I get this:
Throwable in RtmpReader thread: java.lang.StackOverflowError
java.lang.StackOverflowError
at java.util.HashMap$KeySet.iterator(HashMap.java:867)
at java.util.HashSet.iterator(HashSet.java:154)
at
java.util.AbstractCollection.toArray(AbstractCollection.java:173)
at
org.hibernate.collection.PersistentSet.toArray(PersistentSet.java:155)
at java.util.ArrayList.<init>(ArrayList.java:136)
at
flex.messaging.io.ArrayCollection.<init>(ArrayCollection.java:44)
at
flex.messaging.io.amf.Amf3Output.writeArrayCollection(Amf3Output.java:407)
at
flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:147)
at
flex.messaging.io.amf.Amf3Output.writeObjectProperty(Amf3Output.java:215)
at
flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:495)
at
flex.messaging.io.amf.Amf3Output.writeCustomObject(Amf3Output.java:467)
at
flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:165)
at
flex.messaging.io.amf.Amf3Output.writeObjectArray(Amf3Output.java:730)
at
flex.messaging.io.amf.Amf3Output.writeAMFArray(Amf3Output.java:386)
at
flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:151)
at
flex.messaging.io.ArrayCollection.writeExternal(ArrayCollection.java:97)
at
flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:485)
...........(continues this loop for several more
lines).............
One the front end, the client appears to either hang or
timeout with this:
[RPC Fault faultString="Channel disconnected"
faultCode="Client.Error.DeliveryInDoubt" faultDetail="Channel
disconnected before an acknolwedgement was received"]
at mx.data::ConcreteDataService/
http://www.adobe.com/2006/flex/mx/internal::dispatchFaultEvent() at ::DataListRequestResponder/fault()
at mx.rpc::AsyncRequest/fault()
at
::NetConnectionMessageResponder/NetConnectionChannel.as$37:NetConnectionMessageResponder::channelDisconnectHandler()
at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at
mx.messaging::Channel/mx.messaging:Channel::disconnectSuccess()
at
mx.messaging.channels::RTMPChannel/mx.messaging.channels:RTMPChannel::statusHandler()
I'm not sure what the cause is, but I think it may be related
to one of these things:
Possible Cause 1:
The additional rows of data that I'm using to fill my
database have some sort of flaw that is creating a circular
reference among the objects being used by FDS.
Possible Cause 2:
I do not have the settings correct in FDS concerning
lazy-initialization, caching, or some other property that would
prevent the data management service from getting stuck in a loop,
or trying to basically create one object in the object graph for
each row in the database. Obviously if I have 20,000 rows in a
table, I do not want the FDS to create 20,000 in-memory objects in
the object graph that it uses to supply data to the clients, right?
Possible Cause 3:
I have not setup the fill or sync or whatever methods in my
Assemblers correctly that are used by the clients to get data.
Any ideas on where this error might be coming from?