I have two different apps A & B. On startup both use the same DS fill
method (and same fill parameters) to login and authenticate a user.
The fill returns a managed User object (the logged in user). Both
applications work fine on their own. However, I am having the
following problem:

I start application A -> everything works OK
I start application B -> everything work OK (All data is loaded fine)
I terminate application B. -> OK
I start application B again and get the following stack trace:

09:35:07,815 INFO  [STDOUT] [Flex] could not initialize proxy - the
owning Session was closed
org.hibernate.LazyInitializationException: could not initialize proxy
- the owning Session was closed
        at
org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:60)
        at
org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
        at
flex.data.assemblers.HibernatePropertyProxy.getHibernateProxyValue(HibernatePropertyProxy.java:60)
        at
flex.data.assemblers.HibernatePropertyProxy.getAlias(HibernatePropertyProxy.java:67)
        at
flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:533)
        at
flex.messaging.io.amf.Amf3Output.writeCustomObject(Amf3Output.java:518)
        at flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:193)
        at
flex.messaging.io.amf.Amf3Output.writeObjectProperty(Amf3Output.java:243)
        at
flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:549)
        at
flex.messaging.io.amf.Amf3Output.writeCustomObject(Amf3Output.java:518)
        at flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:193)
        at 
flex.messaging.io.amf.Amf3Output.writeObjectArray(Amf3Output.java:800)
        at flex.messaging.io.amf.Amf3Output.writeAMFArray(Amf3Output.java:431)
        at flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:179)
        at
flex.messaging.io.amf.Amf3Output.writeObjectProperty(Amf3Output.java:243)
        at
flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:549)
        at
flex.messaging.io.amf.Amf3Output.writeCustomObject(Amf3Output.java:518)
        at flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:193)
        at flex.messaging.io.amf.Amf0Output.writeObject(Amf0Output.java:181)
        at
flex.messaging.io.tcchunk.TCCommand.getCommandResponse(TCCommand.java:420)
        at
flex.messaging.endpoints.rtmp.AbstractRTMPServer.dispatchMessage(AbstractRTMPServer.java:1013)
        at
flex.messaging.endpoints.rtmp.NIORTMPConnection$RTMPReader.run(NIORTMPConnection.java:435)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
        at java.lang.Thread.run(Thread.java:619)


I am guessing that some Hibernate proxies that the first run of
application B are brought into DS and cached. It then appears that
these are not cleaned up or released when the application B session is
invalidated (must have something to do with application A still being
open). Then when application B is restarted it tries to used the
previously cached proxy but that session (and indeed the whole client
who first requested it) has ended.

All of my relationships or lazily loaded. The object that the initial
fill returns does not cause this problem. It is generated when
accessing relationships off that graph object (but not in the midst of
a getItem call).

I have tried many code changes to work around this but none have
worked (including using a unique ID in the fill parameters). The fact
that the apps work fine on their own tell me that I am using (at least
partially) the technology correctly.

Does anyone have any insight into what might be going on?

Reply via email to