20 Replies Latest reply: Feb 9, 2011 8:12 AM by Joost van der Drift RSS

    CF 9.01 Upgrade breaks Flex Gateway - Help!!!!

    Jeff Battershall

      I have an AIR app which is using DataServicesMessaging with subtopics enabled.  I can create the Consumer in AIR but when I subscribe, I get the following error:

       

      "Error","cfthread-0","08/31/10","21:03:35",,"CATALOG_ATTRIBUTES_831AE0FE-B7D2-90A5-87AD-CA C5E01116D9: Event handler exception."

      flex.messaging.MessageException: Event handler exception.

      at coldfusion.flex.CFEventGatewayAdapter.allowSend(CFEventGatewayAdapter.java:376)

      at flex.messaging.services.messaging.SubscriptionManager.addSubtopicSubscribers(Subscription Manager.java:330)

      at flex.messaging.services.messaging.SubscriptionManager.addSubtopicSubscribers(Subscription Manager.java:311)

      at flex.messaging.services.messaging.SubscriptionManager.getSubscriberIds(SubscriptionManage r.java:264)

      at flex.messaging.services.MessageService.pushMessageToClients(MessageService.java:495)

      at coldfusion.flex.CFEventGatewayAdapter.send(CFEventGatewayAdapter.java:250)

      at coldfusion.eventgateway.flex.FlexMessagingGateway.outgoingMessage(FlexMessagingGateway.ja va:204)

      at coldfusion.runtime.CFPage.SendGatewayMessage(CFPage.java:269)

      at cfCatalogService2ecfc315059253$func_CFFUNCCFTHREAD_CFCATALOGSERVICE2ECFC3150592531.runFun ction(C:\inetpub\wwwroot\staging9sites\staging9si\com\pmdm\suppliers\services\CatalogServi ce.cfc:110)

      at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)

      at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)

      at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)

      at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)

      at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)

      at coldfusion.runtime.UDFMethod.invokeCFThread(UDFMethod.java:201)

      at coldfusion.thread.Task.invokeFunction(Task.java:274)

      at coldfusion.thread.Task.run(Task.java:140)

      at coldfusion.scheduling.ThreadPool.run(ThreadPool.java:201)

      at coldfusion.scheduling.WorkerThread.run(WorkerThread.java:71)

       

        • 1. Re: CF 9.01 Upgrade breaks Flex Gateway - Help!!!!
          Jeff Battershall Community Member

          Looking at the stack trace it would appear there is an issue with allowing subtopic subscriptions - perhaps there's some configuration parameters that have changed in CF 9.01?  The error occurs the very moment that I attempt to subscribe to the destination.

           

          Anyone from Adobe can comment?????

          • 2. Re: CF 9.01 Upgrade breaks Flex Gateway - Help!!!!
            Jeff Battershall Community Member

            Here's how the error looks from the AIR app:

             

            [MessageFaultEvent faultCode="Server.Processing" faultDetail=null faultString="Event handler exception." rootCause=null type="fault" bubbles=false cancelable=false eventPhase=2]

             

            Not real helpful.

            • 3. Re: CF 9.01 Upgrade breaks Flex Gateway - Help!!!!
              raksh naresh Adobe Employee

              Jeff,

                     In CF 9.0.1 allowSend and allowSubscribe event calls is delegated to the user defined allowSend and allowSubscribe methods defined on the gateway cfc. This would allow you to get control to prevent anyone from subscribing or sending to a particular subtopic. These methods can return either a true or false based on whether subscription or sending should be allowed for that user.

               

              The only condition though is that these functions will be invoked in gateway cfc only if the gateway id is specified under the messaging destination in messaging-config.xml instead of the default * present under the destination.

              1. While subscribing, consumer.subtopic has to be set to the subtopic string.

              2. While sending, DSSubtopic has to be set on the message header.
              msg.headers["DSSubtopic"] = "abc";

              3. In onincomingmessage, DSSubtopic has to be on the message header by picking it up from the event object.

                 <cfset msg.headers["DSSubtopic"] = event.data.headers.DSSubtopic />   

              4. allow-subpoic has to set to true in the messaging-config.xml destination.4.

                          <server>
                  <allow-subtopics>true</allow-subtopics>
                 </server>

              It looks to me that this error is coming up when allowSend is being invoked on the gateway cfc. Although care is taken that if the method is not defined in the gateway cfc, a default true is returned back. Try adding an allowSend method that takes in an argument of type any that just returns true.

               

              Also can you give me a sample code that is causing this error? Both the code on the client side that subscribes and the entry in messaging-config.xml.

               

              Rakshith

              • 4. Re: CF 9.01 Upgrade breaks Flex Gateway - Help!!!!
                Jeff Battershall Community Member

                Rakshith,

                 

                Thanks for your help!  Here's what I've got in my messaging-config.xml:

                 

                <?xml version="1.0" encoding="UTF-8"?>

                <service id="message-service"

                    class="flex.messaging.services.MessageService"

                    messageTypes="flex.messaging.messages.AsyncMessage">

                 

                    <adapters>

                        <adapter-definition id="cfgateway" class="coldfusion.flex.CFEventGatewayAdapter" default="true" />

                        <adapter-definition id="actionscript" class="flex.messaging.services.messaging.adapters.ActionScriptAdapter"/>

                        <adapter-definition id="jms" class="flex.messaging.services.messaging.adapters.JMSAdapter"/>

                    </adapters>

                 

                    <!-- ======================================== -->

                    <!--  ColdFusion Messaging Gateway            -->

                    <!-- ======================================== -->

                    <destination id="ColdFusionGateway">

                        <adapter ref="cfgateway" />

                        <properties>

                            <!--

                                Star ('*') means gatewayid is found in the 'gatewayid' message header.

                                To restrict this destination to a specific gateway, enter its ID here

                            -->

                            <gatewayid>PMSIMessages</gatewayid>

                 

                <server>

                <durable>false</durable>

                <allow-subtopics>true</allow-subtopics>

                </server>

                 

                            <!--

                                If ColdFusion is running on a different host, enter that here.

                                Default is to expect ColdFusion and Flex to share the same web application.

                You must enter 'localhost' if CF and Flex are not in the same web app.

                 

                            <gatewayhost>10.1.1.1</gatewayhost>

                            -->

                 

                            <!--

                                List the IP addresses of CF machines allowed to send messages to this destination

                                If not set, the default is to allow only this computer to connect.

                 

                            <allowedIPs>10.1.1.1,10.2.2.2</allowedIPs>

                            -->

                 

                            <!--

                                Credentials to pass along in the headers as CFUsername/CFPassword.

                                It is generally better to use setRemoteCredentials() API on client.

                 

                            <remote-username></remote-username>

                            <remote-password></remote-password>

                            -->

                 

                            <!--

                                You can add general Flex Messaging network and server properties here.

                             -->

                 

                        </properties>

                 

                <!-- You should use the ColdFusion specific channels -->

                        <channels>

                            <channel ref="cf-polling-amf"/>

                        </channels>

                    </destination>

                 

                    <destination id="clientNotifierGateway">

                    <adapter ref="actionscript"/>

                    <channels>

                    <channel ref="java-amf"/>

                    </channels>

                     </destination>

                 

                 

                </service>

                 

                Here's my gateway CFC:

                 

                <cfcomponent output="false">

                   <cffunction name="onIncomingMessage" access="remote" returntype="any">

                         <cfargument name="event" type="struct" required="true"/>

                 

                <cfscript>

                      x = structNew();

                      x['body'] = event.data;

                      x['destination'] = "ColdFusionGateway";

                      x['headers'] = structNew();

                      x.headers['username'] = "System";

                      x.headers['DSSubtopic'] = event.data.headers.DSSubtopic;

                      x.lowercasekeys = "yes";

                      </cfscript>

                 

                  <cfreturn x/>

                 

                </cffunction>

                 

                <cffunction name="allowSend" access="public" returntype="boolean">

                <cfargument name="subtopic" type="any" required="true"/>

                 

                <cfreturn true/>

                 

                </cffunction>

                 

                <cffunction name="allowSubscribe" access="public" returntype="boolean">

                <cfargument name="subtopic" type="any" required="true"/>

                 

                <cfreturn true/>

                 

                </cffunction>

                 

                </cfcomponent>

                 

                Jeff

                 

                 

                • 5. Re: CF 9.01 Upgrade breaks Flex Gateway - Help!!!!
                  Jeff Battershall Community Member

                  Rakshith,

                   

                  I forgot to include the client side code. Here you go:

                   

                  messageSubscriber = new Consumer();

                  messageSubscriber.channelSet = new ChannelSet()

                  var endPoint:String = appModel.activeMode.serviceURL + '/flex2gateway/cfamfpolling';

                  var channel:AMFChannel = new AMFChannel("cf-polling-amf",endPoint);

                  channel.enableSmallMessages = false;

                  messageSubscriber.channelSet.addChannel(channel);

                  messageSubscriber.addEventListener(MessageEvent.MESSAGE, onMessageReceived);

                  messageSubscriber.addEventListener(MessageFaultEvent.FAULT,onMessageError);

                  messageSubscriber.destination = "ColdFusionGateway";

                  messageSubscriber.subtopic = UIDUtil.createUID();

                  messageSubscriber.subscribe();

                   

                  Jeff

                  • 6. Re: CF 9.01 Upgrade breaks Flex Gateway - Help!!!!
                    Jeff Battershall Community Member

                    Rakshith,

                     

                    Here's the raw request data from Flash Builder Network Monitor.  I've removed host name for security reasons.

                     

                    POST /flex2gateway/cfamfpolling HTTP/1.1

                    Content-Type: application/x-amf

                    User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/531.9 (KHTML, like Gecko) AdobeAIR/2.0.2

                    Referer: app:/PMSIFlex4.swf

                    X-Flash-Version: 10,1,53,64

                    Accept: */*

                    Accept-Language: en-us

                    Accept-Encoding: gzip, deflate

                    Cookie: CFAUTHORIZATION_PMSMS_20100903_03=amJhdHRlcnNoYWxsQGNvbWNhc3QubmV0DXRyYW50b3I1MQ1QTVNNU18 yMDEwMDkwM18wMw==; JSESSIONID=3830564a83cfc4c59efb7e5ac77692645221; CFTOKEN=19927261; CFID=12012; nuuid=3f7376d4-bec5-102d-8926-001e0b5ddf58

                    Content-Length: 349

                     

                    Flex Message (flex.messaging.messages.CommandMessage)     operation = subscribe    selector = null    clientId = null    correlationId =     destination = ColdFusionGateway    messageId = 0D653381-10E7-A801-B9F2-D7BBDF71AA8B    timestamp = 0    timeToLive = 0    body = {}    hdr(DSId) = 98CE40E4-0B1E-04DC-3DBB-45AD576213A9    hdr(DSSubtopic) = 175C777A-ACAB-BF69-BCD2-D7BBDF6EC70D    hdr(DSEndpoint) = messageChannel

                     

                    Jeff

                    • 7. Re: CF 9.01 Upgrade breaks Flex Gateway - Help!!!!
                      raksh naresh Adobe Employee

                      Jeff,

                           Thanks for the sample code and network monitor data. The info you have provided should help us reproduce the issue here.

                       

                      I will get back to you once we try this out.

                       

                      Rakshith

                      • 8. Re: CF 9.01 Upgrade breaks Flex Gateway - Help!!!!
                        Jeff Battershall Community Member

                        Rakshith,

                         

                        One additional note - we're running CF in multi-server mode and the problem we're having is on an instance created before the upgrade using Instance Manager.  Would there be any value in a clean re-install of CF 9.01 not as a upgrade but as a new install? I'd rather not go to all that trouble, but I'm just asking.

                         

                        Jeff

                        • 9. Re: CF 9.01 Upgrade breaks Flex Gateway - Help!!!!
                          raksh naresh Adobe Employee

                          Jeff,

                               My team mate here tried to reproduce the issue. He is somehow not encountering the issue. I will check again with him.

                           

                          CF 9.0.1 does not a full installer. Upgrading from CF 9.0 is the only option.

                           

                          Rakshith

                          • 10. Re: CF 9.01 Upgrade breaks Flex Gateway - Help!!!!
                            Jeff Battershall Community Member

                            Rakshith,

                             

                            So if you download CF as a trial, you'll only be installing CF 9.0 and have to install 9.01 separately?

                             

                            Could there be value in re-creating the CF instance we're using?  I'm wondering if the upgrade has an issue with instances previously created via Instance Manager.  Just grasping at straws here.

                             

                            Jeff

                            • 11. Re: CF 9.01 Upgrade breaks Flex Gateway - Help!!!!
                              Jeff Battershall Community Member

                              On another machine, running OS X and CF 9.0.1 Developer Edition, messaging is working fine.  So it would appear that the problem is 'environment specific'.   The production machine in question is running Windows 2008 32-bit with CF Multi-Server.

                              • 12. Re: CF 9.01 Upgrade breaks Flex Gateway - Help!!!!
                                raksh naresh Adobe Employee

                                Yes, that's right.

                                 

                                You will be installing CF 9.01 and you have to upgrade that to CF 9.0.1 using the CF 9.0.1 updater.

                                • 13. Re: CF 9.01 Upgrade breaks Flex Gateway - Help!!!!
                                  raksh naresh Adobe Employee

                                  Are you saying that the same code runs fine on the OS X developer edition? If yes, then it would be worth going through the upgrade process again.

                                   

                                  I don't think the issue can be environment specific.

                                  • 14. Re: CF 9.01 Upgrade breaks Flex Gateway - Help!!!!
                                    Jeff Battershall Community Member

                                    I've resolved the issue.  The gateway CFC was residing in an application root that also referenced Mach-ii and ColdSpring.  Previously, it appears that the Application.cfc wasn't getting invoked when subscribing to the destination - now it is and was throwing a framework exception.  I've moved my gateway CFC to its own application and now it's working as expected.

                                     

                                    Thanks for your help.

                                     

                                    Jeff

                                    • 16. Re: CF 9.01 Upgrade breaks Flex Gateway - Help!!!!
                                      Jeff Battershall Community Member

                                      On a related topic, is there more information available on the allowSend and allowSubscribe functions?  A sample CFC perhaps?

                                      • 17. Re: CF 9.01 Upgrade breaks Flex Gateway - Help!!!!
                                        raksh naresh Adobe Employee

                                        The only information we have now is here http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSd160b5fdf5100e8f512047ac12a37f1eaf b-8000.html

                                         

                                        Perhaps I can come up with a blog entry describing this one in detail.

                                        • 18. Re: CF 9.01 Upgrade breaks Flex Gateway - Help!!!!
                                          Joost van der Drift

                                          Hi,

                                          I''m getting a non-descriptive error

                                          Error Occurred While Processing Request - Google Chrome.jpg

                                           

                                          The stack trace says the following

                                          Error Occurred While Processing Request - Google Chrome_2.jpg

                                           

                                          I don't know how to fix this. In my CFC I have

                                           

                                               <cffunction name="allowSend" access="public" returntype="boolean">
                                                    <cfargument name="subtopic" type="any" required="true"/>
                                                     
                                                    <cfreturn true/>
                                                     
                                               </cffunction>
                                          
                                           
                                          

                                           

                                          Hope anyone can help

                                          • 19. Re: CF 9.01 Upgrade breaks Flex Gateway - Help!!!!
                                            fedsol Community Member

                                            I'm running 8.0.1, but might be helpful to you anyway. Another undocumented change in this patch is that CFC functions called from Flex must have access="remote" set on them; without this patch they did not. I woke up today to a "our (Flex-based) site is down, help!" call and found my exception.log full of

                                            "The method 'foo' in component bar cannot be accessed remotely. "
                                            • 20. Re: CF 9.01 Upgrade breaks Flex Gateway - Help!!!!
                                              Joost van der Drift Community Member

                                              Hi

                                              thanks for the reply. My issue however appears when addressing the gateway from Coldfusion. I do not address the gateway from Flex.

                                               

                                              Regards,

                                              Joost