Skip navigation
Currently Being Moderated

Two Flex app on the same web page + BlazeDS

Jun 12, 2009 12:55 PM

Hi,


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?

 
Replies
  • Currently Being Moderated
    Jun 23, 2009 2:52 PM   in reply to Ugo Ducharme

    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.

     

    -Alex

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 24, 2009 9:08 AM   in reply to Alex Glosband

    Hi Alex,

    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.

     

    Thanks,

    Anil

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 6, 2009 6:52 AM   in reply to Ugo Ducharme

    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.

     

    -Alex

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 17, 2009 12:09 AM   in reply to Ugo Ducharme

    Hi Alex,

    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.

    Regards Vamsi.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 17, 2009 3:53 AM   in reply to F2001383

    Vamshi,

     

    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.

     

    Thanks,

    Anil

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 17, 2009 4:33 AM   in reply to anilwanted

     

    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"

    url="http://myserver:80/index.html"

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 17, 2009 4:39 AM   in reply to F2001383

    Hi Vamsi,

    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:-

    photoService.send();

     

     

    After you get a response ffor the above send you can start RO calls.

     

    That works for me.

     

    Thanks,

    Anil

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 17, 2009 4:44 AM   in reply to anilwanted

    Thanks Anil,

     

    Will do the same and see if it is not repeating.

     

    regards vamsi

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 1, 2010 9:18 AM   in reply to Ugo Ducharme

    Hi. For anyone who is still interested in the duplicate session detected errors problem I have blogged about it here and proposed some workarounds.

     

    http://www.alexglosband.com/?p=3

     

    -Alex

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 18, 2010 5:30 AM   in reply to Alex Glosband

    Hi,

     

    I have posted a solution here , which i used to resolve this issue.

     

    Regards

    Siva

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points