3 Replies Latest reply on Feb 4, 2011 2:50 AM by PawelJ

    BlazeDS, multiple Module instances with Consumers issue

    FSB Lee

      I have an application that can load multiple instances of a module. The module has a consumer that connects to a destination and listens for messages pushed from a JMS topic. In order for me to be able to load and unload multiple instances of the module I'm appending a uid to the url of the swf. When the first instance of the module is loaded everything works as expected and the consumer successfully subscribes to the destination. However, if a second instance of the module is loaded the consumer fails to subscribe and I see the following error in the server log:

       

      [#|2010-10-28T15:05:33.666+0100|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ ThreadID=17;_ThreadName=httpSSLWorkerThread-8080-1;|

      [BlazeDS]10/28/2010 [INFO] [Endpoint.General] Channel endpoint channel-streaming-amf received request.|#]

       

      [#|2010-10-28T15:05:33.671+0100|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ ThreadID=17;_ThreadName=httpSSLWorkerThread-8080-1-in-streaming-mode;|

      [BlazeDS]10/28/2010 [WARN] [Endpoint.StreamingAMF] Endpoint with id 'channel-streaming-amf' received a duplicate streaming connection request from, FlexClient with id '4CA3967A-071C-AB24-D5B9-CAB9D20F14B5'. Faulting request.|#]

       

      [#|2010-10-28T15:05:33.671+0100|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ ThreadID=17;_ThreadName=httpSSLWorkerThread-8080-1;|

      [BlazeDS]10/28/2010 [INFO] [Endpoint.FlexSession] Number of streaming clients for FlexSession with id '3275dcec0f5dc0c30a7381fa6044' is 0.|#]

       

      [#|2010-10-28T15:05:33.672+0100|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ ThreadID=17;_ThreadName=httpSSLWorkerThread-8080-1;|

      [BlazeDS]10/28/2010 [DEBUG] [Endpoint.StreamingAMF] Number of streaming clients for endpoint with id 'channel-streaming-amf' is 0.|#]

       

      [#|2010-10-28T15:05:33.673+0100|SEVERE|sun-appserver2.1|javax.enterprise.system.container. web|_ThreadID=17;_ThreadName=httpSSLWorkerThread-8080-1;_RequestID=96f36b13-0da4-49ad-b788 -bc6d1413da3b;|StandardWrapperValve[MessageBrokerServlet]: PWC1406: Servlet.service() for servlet MessageBrokerServlet threw exception

      java.lang.IllegalStateException

      at org.apache.coyote.tomcat5.CoyoteResponseFacade.sendError(CoyoteResponseFacade.java:449)

      at flex.messaging.endpoints.BaseStreamingHTTPEndpoint.handleFlexClientStreamingOpenRequest(B aseStreamingHTTPEndpoint.java:732)

      at flex.messaging.endpoints.BaseStreamingHTTPEndpoint.serviceStreamingRequest(BaseStreamingH TTPEndpoint.java:1022)

      at flex.messaging.endpoints.BaseStreamingHTTPEndpoint.service(BaseStreamingHTTPEndpoint.java :430)

      at flex.messaging.MessageBrokerServlet.service(MessageBrokerServlet.java:322)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

      at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.jav a:427)

      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:333)

      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncoding Filter.java:88)

      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76 )

      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:246)

      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)

      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:313)

      at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:28 7)

      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)

      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)

      at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPi peline.java:98)

      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)

      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)

      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)

      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)

      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)

      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)

      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)

      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)

      at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:291)

      at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProces sorTask.java:666)

      at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorT ask.java:597)

      at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTas k.java:872)

      at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultRead Task.java:341)

      at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)

      at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)

      at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:264)

      at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106 )

      |#]

       

      Can anyone explain to me what is happening here and suggest a solution please? I'm not sure if it's a BlazeDS issue or a Flex Module issue but I can't seem to find any references to this issue and the last 2 days have been spent trying to resolve this without any success.

       

      Any help appreciated.

       

      If I don't append the uid to the module url then the consumers subscribe as expected but then I'm unable to unload individual instances of the module as they all share the same url property.

       

      Thanks in advance.

        • 1. Re: BlazeDS, multiple Module instances with Consumers issue
          baluvg

          I am too dealing with the same issue. Any pointers to fix this will be very helpful.

           

          -Balu

          • 2. Re: BlazeDS, multiple Module instances with Consumers issue
            FSB Lee Level 1

            I managed to solve the duplicate streaming request issue by creating a

            new ChannelSet in the shell application to which I added a new

            StreamingAMFChannel. To create the StreamingAMFChannel I used the

            mx.messaging.config.ServerConfig class to get a reference to the

            StreamingAMFChannel defined in my services-config.xml file. I was then

            able to access the @id and @uri attributes of the channel using the

            'xml' property of the ServerConfig class to create the

            StreamingAMFChannel.

             

            In my modules, whenever I instantiate a Consumer I set the

            'channelSet' property of the Consumer to the ChannelSet I created in

            the shell (using mx.core.FlexGlobals.topLevelApplication). I can now

            open multiple instances of the same module that each contain their own

            Consumer instance and they all subscribe successfully.

             

            I'm still appending a UID to the module's URL to enable unloading of

            specific module instances.

             

            I'm using BlazeDS 3.2.0.3978.

             

            I hope this helps others.

            • 3. Re: BlazeDS, multiple Module instances with Consumers issue
              PawelJ

              I have similar problem, but I don't understand your solution.

               

              Hypothetically, let’s say I use 2 separate sets of Consumer/Producer components in my flex app.

              There is no problem with connecting first set of Consumer/Producer to a particular channel.

               

              For second set of Consumer/Producer I create new ChannelSet  and new StreamingAMFChannel instances (but the channel has the same URL as the one used in first set, because I want to use the same channel).

              When I try to connect another set of Consumer/Producer to the same channel I get the error on BlazeDS: "... Endpoint with id 'streaming-amf' received a duplicate streaming connection request from, FlexClient with id ..."

               

              There is no such problem when I define additional channel in BlazeDS configuration an use this new channel with second set of Consumer/Producer components. This solution requires this additional channel so it’s not fully satisfying for me.

               

              Could you post some code samples of your solution or describe it in more detail?

              I will be grateful for any useful tips.