One Flex client connecting to two webapps using BlazeDS - Detected duplicate HTTP-based FlexSessions

笑着哭i 提交于 2019-12-04 19:36:00

Three potential solutions for you:

  1. I found once that if I hit a remote object before setting up a messaging channel then the CientID would get screwed up. Try to establish an initial messaging channel once the application loads, and before any remote object calls are made.

  2. Flash Builder's network monitoring tool can cause some problems with BlazeDS. I set up a configuration option on application load that checks to see if I'm in the dev environment (it is called just before setting up my channel from #1). If I'm in dev, I assign a UID manually. For some reason this doesn't take well outside the dev environment... been awhile since I set it all up so I can't remember the finer points as to why:

    if (!(AppSettingsModel.getInstance().dev))
         FlexClient.getInstance().id = UIDUtil.createUID();
    
  3. BlazeDS by default only allows for a single HTTP session to be setup per client/browser. In my streaming channel definitions I added the following to allow for additional sessions per browser:

    <channel-definition id="my-secure-amf-stream" class="mx.messaging.channels.SecureStreamingAMFChannel"> 
        <endpoint url="https://{server.name}:{server.port}/FlexClient/messagebroker/securestreamingamf"  
            class="flex.messaging.endpoints.SecureStreamingAMFEndpoint"/>
        <properties>
            <add-no-cache-headers>false</add-no-cache-headers>
            <idle-timeout-minutes>0</idle-timeout-minutes> 
            <max-streaming-clients>10</max-streaming-clients> 
            <server-to-client-heartbeat-millis>5000</server-to-client-heartbeat-millis> 
            <user-agent-settings>
                <user-agent match-on="MSIE" kickstart-bytes="2048" max-streaming-connections-per-session="3" /> 
                <user-agent match-on="Firefox" kickstart-bytes="2048" max-streaming-connections-per-session="3" /> 
            </user-agent-settings>
        </properties>
    
Rohit

Problem: Duplicate session errors when flex.war and Livecycle.lca files are hosted in separate JVMs on WebSphere Server.

Solution:
Inside the command file for the event, set FlexClientId to null in execute method before calling remote service (Java method or LC Process).
Guess this approach can be used in other scenarios as well to prevent Duplicate session errors.

EventCommand.as file
—————————–

import mx.messaging.FlexClient;
//other imports as per your code

public function execute(event:CairngormEvent):void
{
    var evt:EventName = event as EventName ;

    var delegate:Delegate = new DelegateImpl(this as IResponder);

    //***set client ID to null
    FlexClient.getInstance().id = null;

    delegate.functionName(evt.data);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!