SWF Loader issue with clustered env
Last week i got stuck in a strange issue:
We had a application (which under normal development work ) was being built on a single machine system with no clustered env.
It had a Web application built using Flex 4.6 framework integrated with spring and blaze-ds to contact back end layer built in java. This looked good all on dev system but started troubling on integration system which mimicked more like production having multiple boxes and each box having multiple servers clustered together.
In the application , we had complex situation in which a swf application was loading another swf application within a popup (when I say swf application , it was APPLICATION not the MODULES). So when the primary application tried to open the secondary swf within for the first time , there was no response from the server . The secondary swf bytes were fetched but nothing was shown on the screen. But subsequent hits to open the pop up with secondary swf resulted in success . So the question was the reason of first time failure.
On deeper analysis showed that , when the first time secondary swf was loaded from the server , there was no session ID passed as cookies to the load balancer , but still swf bytes were loaded. On the first invocation of blaze ds request within the secondary SWF , resulted in the create of session id . due to this the first invocation failed but subsequent worked well. This phenomenon was not noticed in single server env (like local dev systems) but were only found in clustered system with load balancer in place.
So the solution was to somehow create the session id even before first request of blaze ds was made .
The easiest way to do this was make a dummy HTTP request from the secondary swf immediate after its loaded (basically just after creation complete ) event. As this dummy HTTP request to any servlet on server would surely create a session ( until or unless there is request.getSession() method in servlet ).
So any subsequent request of balze ds would pick this session id and continue its work as normal.
This worked for us , hope it helps some one else too.