On our welcome page, we have two small apps that display advertisement; they are both identical and use BlazeDS. When the welcome pas shows, I always have one of the app that receives this fault :
[RPC Fault faultString="Detected duplicate HTTP-based FlexSessions, generally due to the remote host disabling session cookies. Session cookies must be enabled to manage the client connection correctly." faultCode="Server.Processing.DuplicateSessionDetected" faultDetail="null"]
I feel the problem comes from the fact that two apps from the same page access the same service at the same time. Am I wrong?
Hi. I believe you are right. Using a HTTP sniffer such as Charles to look at the HTTP headers would tell us exactly what is happening but I think we can assume that you are in the ballpark.
If the server gets a request with no session cookie header, I think it will create a new session and then send a Set-Cookie header on the response with the new session id. It is likely that if both your apps are making their initial requests to the server at roughly the same time that neither of the requests has a session cookie header. In that case the server is probably creating two sessions, one for each request and that is likely causing problems.
While I haven't tested this particular scenario, I have been doing some testing around session cookie handling in BlazeDS recently. I would see if you can workaround this problem by already having a HTTP session established with the server before either of your apps runs. One way to do this would be by having a jsp page redirect to your welcome page. The call to the jsp page would cause a session to get created on the server. The server would return a Set-Cookie header with the new session id. The browser would then request the welcome page sending a session cookie header on the request. Your apps would load. Each app would make its initial request to the server only this time the requests would contain a session cookie header for the same valid HTTP session. . . and you would avoid getting duplicate session detected errors. . . at least that's I hope would happen.
If I have some free time I will try running through this scenario (having two small apps on the same page) and report back.
Hope that helps.
I faced similar problem.
But i was not having two apps.
In teh same app i was using both http service and blaze ds.
So to fix my problem i first did the http service request then started blaze calls.
Everythng worked fine.
Thank you very much.
Sure, you can log a bug for this at http://bugs.adobe.com.
Even if it's not something we can fix in the BlazeDS code, we should at least come up with and document a reasonable workaround as you are right that it is probably a fairly common use case.
So we have any work around as of now.
And Anil, please let me know how you solved this duplicate session problem. U said some thing in blog, Can you explain slightly more deeply, wht we have to do to temporarily escape that.
In my situation i had only one flex app in the page.
To avoid getting the error i first did a created a HttpService Request to the server(in my case i requested for the version).
After i got the response for that request i ustarted using RPC using Blaze DS.
Hi Anil, Thanks for the reply. Even we are using the single application only. But some times we keep getting that and I am not able to rectify till I restart the server... Today to my surprise that restarting server also didn't help :-( So in code when your application started u are just making one dummy call like this? <mx:HTTPService id="photoService" resultFormat="e4x" result="ResultHandler(event);" fault="FaultHandler(event);" /> And then u are staring RO calls to blaze DS? Else please post me your code. Thanks in advance. regards Vamsi
Thanks for the reply. Even we are using the single application only. But some times we keep getting that and I am not able to rectify till I restart the server... Today to my surprise that restarting server also didn't help :-(
So in code when your application started u are just making one dummy call like this?
And then u are staring RO calls to blaze DS?
Else please post me your code.
Thanks in advance.
You are right.
I define a dummy servicve as you did.
Then i made an actual call in creation complete.
In your case it would be:-
After you get a response ffor the above send you can start RO calls.
That works for me.
Europe, Middle East and Africa