13 Replies Latest reply on Nov 5, 2006 9:31 AM by tedevang

    Error on HelloWorld Flex Application

    tedevang
      Hi,

      I just tried the HelloWorld application from the CF-Flex section of Adobe's web site and get the following error:

      faultCode:Client.Error.MessageSend
      faultString: 'Send failed'
      faultDetail:'Channel.Connect.Failed error
      NetConnection.Call.Failed: HTTP: Failed'

      I have CF 7.0.2 running fine on localhost, and Flex Data Services is working fine on it's own.

      Here is what I have for the Additional compiler arguments:
      -services "C:\Inetpub\wwwroot\WEB-INF\flex\services-config.xml" -locale en_US

      I've tried the endpoint in services-config.xml as both:

      <endpoint uri=" http://{server.name}:{server.port}{context.root}/flex2gateway/" class="flex.messaging.endpoints.AMFEndpoint"/>

      and

      <endpoint uri=" http://localhost/flex2gateway/" class="flex.messaging.endpoints.AMFEndpoint"/>

      and both give the same error.

      Any ideas?
        • 1. Re: Error on HelloWorld Flex Application
          pwp69
          I am having the same problem. I can get data via WebService and FDS but not RemoteObjects.

          I am running CFMX 7.0.2 J2EE on TOMCAT 5.5.
          • 2. Re: Error on HelloWorld Flex Application
            CathyM
            If you're using
            http://{server.name}:{server.port}{context.root}/flex2gateway
            then you'll need to specify the -context.root option with the value of your web application context root when you compile. What's the context root for the application that's running the /flex2gateway servlet? Be sure to include that.

            > and both give the same error.

            Are you sure that's the url where your application is running? What happens if you make a request from the browser to http://localhost/flex2gateway?
            • 3. Re: Error on HelloWorld Flex Application
              tedevang Level 1
              When I make a request to http://localhost/flex2gateway I get a 404 - page not found. How do I set up the flex2gateway servlet - I just followed the basic setup instructions and didn't find anything about flex2gateway.

              The endpoint line I'm currently using is "<endpoint uri=" http://localhost/flex2gateway/" class="flex.messaging.endpoints.AMFEndpoint"/>" so I don't believe I need to supply a context root.

              • 4. Re: Error on HelloWorld Flex Application
                pwp69 Level 1
                Thank you, Cathy.

                Adding the context-root argument did the trick!
                • 5. Re: Error on HelloWorld Flex Application
                  CathyM Level 1
                  > Adding the context-root argument did the trick!
                  Great, one user is off and running with FDS.

                  > When I make a request to http://localhost/flex2gateway I get a 404 - page not found. How do I set up the flex2gateway servlet - I just followed the basic setup instructions and didn't find anything about flex2gateway.

                  Okay, this is the issue that needs to be resolved. The flex2gateway servlet should be defined in the CF application at /WEB-INF/web.xml. If you open that file, can you see the definition? You should see an uncommented reference to both MessageBrokerServlet as well as flex2gateway servlet-mapping. If you have a server startup log, do you see the name of the servlet during server startup. If that all checks out, the next thing to look at is the context path for the application. What url do you use to access your cfm files?

                  > The endpoint line I'm currently using is "<endpoint uri=" http://localhost/flex2gateway/" class="flex.messaging.endpoints.AMFEndpoint"/>" so I don't believe I need to supply a context root.

                  Correct, since you're not using {context-root}, you don't need to supply the argument. However, the uri doesn't appear to be correct based on the 404 error above.
                  • 6. Re: Error on HelloWorld Flex Application
                    tedevang Level 1
                    Here is the relevant excerpt from the web.xml file in c:\inetpub\wwwroot\WEB-INF:

                    <!-- start flex 2 -->
                    <servlet-mapping id="macromedia_mapping_0">
                    <servlet-name>MessageBrokerServlet</servlet-name>
                    <url-pattern>/flex2gateway/*</url-pattern>
                    </servlet-mapping>
                    <!-- end flex 2 -->

                    FDS Startup excerpt:

                    Starting Macromedia JRun 4.0 (Build 106363), default server
                    Flex OEM License for JRun enabled
                    10/31 15:06:47 warning Unable to open C:\fds2\jrun4/lib/license.properties
                    10/31 15:06:48 info JRun Naming Service listening on *:2907
                    10/31 15:06:49 info No JDBC data sources have been configured for this server (s
                    ee jrun-resources.xml)
                    10/31 15:06:50 info JRun Web Server listening on *:8700
                    10/31 15:06:50 info Deploying web application "Flex Default Web Application" fro
                    m: file:/C:/fds2/jrun4/servers/default/default-war/
                    10/31 15:06:50 user JSPServlet: init
                    10/31 15:06:50 info Deploying web application "Flex Data Services" from: file:/C
                    :/fds2/jrun4/servers/default/flex/
                    10/31 15:06:51 user JSPServlet: init
                    10/31 15:06:52 user FlexMxmlServlet: init
                    10/31 15:06:53 INFO Loading configuration file C:\fds2\jrun4\servers\default\fle
                    x\WEB-INF\flex\flex-webtier-config.xml
                    10/31 15:06:54 INFO Loading configuration file C:\fds2\jrun4\servers\default\fle
                    x\WEB-INF\flex\flex-config.xml
                    10/31 15:06:54 user FlexMxmlServlet: Starting Adobe Flex Web Tier Compiler
                    10/31 15:06:54 user FlexMxmlServlet: Adobe Flex Web Tier Compiler Build: 143451
                    10/31 15:06:54 user MessageBrokerServlet: init
                    10/31 15:06:55 user FlexSwfServlet: init
                    10/31 15:06:55 user FlexInternalServlet: init
                    10/31 15:06:56 info Deploying web application "Flex Admin Web Application" from:
                    file:/C:/fds2/jrun4/servers/default/flex-admin/
                    10/31 15:06:56 user JSPServlet: init
                    10/31 15:06:57 user MessageBrokerServlet: init
                    10/31 15:06:58 info Deploying web application "Flex Data Services Samples" from:
                    file:/C:/fds2/jrun4/servers/default/samples/
                    10/31 15:06:58 user JSPServlet: init
                    10/31 15:07:00 user FlexMxmlServlet: init
                    10/31 15:07:00 INFO Loading configuration file C:\fds2\jrun4\servers\default\sam
                    ples\WEB-INF\flex\flex-webtier-config.xml
                    10/31 15:07:01 INFO Loading configuration file C:\fds2\jrun4\servers\default\sam
                    ples\WEB-INF\flex\flex-config.xml
                    10/31 15:07:01 user FlexMxmlServlet: Starting Adobe Flex Web Tier Compiler
                    10/31 15:07:01 user FlexMxmlServlet: Adobe Flex Web Tier Compiler Build: 143451
                    10/31 15:07:01 user MessageBrokerServlet: init
                    10/31 15:07:03 user FlexSwfServlet: init
                    10/31 15:07:03 user FlexInternalServlet: init
                    10/31 15:07:03 info Deploying enterprise application "JRun 4.0 Internal J2EE Com
                    ponents" from: file:/C:/fds2/jrun4/lib/jrun-comp.ear
                    10/31 15:07:03 info Deploying EJB "JRunSQLInvoker" from: file:/C:/fds2/jrun4/lib
                    /jrun-comp.ear
                    Server default ready (startup time: 19 seconds)

                    I use http://localhost to access my local ColdFusion files.
                    • 7. Re: Error on HelloWorld Flex Application
                      p_watson Adobe Employee
                      Are you certain that you are getting a 404 error when you request http://localhost/flex2gateway ?

                      I would expect a 500 error from the browser - that's what I get when I make that request, and it's the expected result
                      The endpiont is configured @ http://localhost/flex2gateway/ (* note that the trailing slash is needed)

                      Does HelloWorld work for you?

                      regards,
                      peter
                      • 8. Re: Error on HelloWorld Flex Application
                        tedevang Level 1
                        Yes, the error is a 404 - file not found. Here is the relevant excerpt from my services-config.xml file:

                        <channels>
                        <channel-definition id="my-cfamf" class="mx.messaging.channels.AMFChannel">
                        <!-- <endpoint uri=" http://{server.name}:{server.port}{context.root}/flex2gateway/" class="flex.messaging.endpoints.AMFEndpoint"/> -->
                        <endpoint uri=" http://localhost/flex2gateway/" class="flex.messaging.endpoints.AMFEndpoint"/>
                        <properties>
                        <polling-enabled>false</polling-enabled>
                        <serialization>
                        <instantiate-types>false</instantiate-types>
                        </serialization>
                        </properties>
                        </channel-definition>
                        </channels>

                        So far I can only get HelloWorld to work with web services, not with RemoteObject.

                        Thanks.
                        • 9. Re: Error on HelloWorld Flex Application
                          tedevang Level 1
                          I've also noticed references to "/WEB-INF/flex/flex-services.xml" in other postings but I don't have a flex-services.xml file in my system. Is it possible that I need to reload CF?
                          • 10. Re: Error on HelloWorld Flex Application
                            CathyM Level 1
                            quote:

                            Originally posted by: tedevang
                            I've also noticed references to "/WEB-INF/flex/flex-services.xml" in other postings but I don't have a flex-services.xml file in my system. Is it possible that I need to reload CF?


                            /WEB-INF/flex/flex-services.xml was renamed services-config.xml in the released version of FDS 2

                            • 11. Re: Error on HelloWorld Flex Application
                              tedevang Level 1
                              Thanks Cathy - can you take a look at my previous 2 postings where I indicate the contents of my services-config.xml and web.xml files, as well as the start up log of FDS 2 and see if you can spot any settings that could be causing the flex2gateway problem I'm having.
                              • 12. Re: Error on HelloWorld Flex Application
                                CathyM Level 1
                                If you're trying to access a CFC via Remoting, you'll need to use the Remoting configured in CF.

                                If you're trying to access Java resources, then you'll use the Remoting configured in FDS. For example, the Java Remoting examples that come with FDS should be accessed through FDS.

                                In either case, the services-config.xml file is dual purpose. It is used on server startup (CF or FDS) to expose the server-side endpoints. It is also used at compile time. If you are using Flex Builder or the standalone compiler, you must specify the services-config.xml using the -services compiler argument. If you're using the web tier compiler, the services-config.xml in the web application is used automatically.

                                In your case, you're trying to access a CFC through CF and Remoting.

                                So,

                                (a) MessageBrokerServlet and the flex2gateway mapping is defined in C:\Inetpub\wwwroot\WEB-INF\web.xml

                                Based on your information, this seems correct.

                                (b) Expose the AMF Endpoint for Remoting on the CF server.

                                This is in C:\Inetpub\wwwroot\WEB-INF\flex\services-config.xml.

                                Based on your information, this seems correct.

                                (c) The destination should be configured in the services-config.xml used by the server that is going to expose the destination. In your case, it's a CFC, which will be exposed through CF, so you'll need to add the destination to C:\Inetpub\wwwroot\WEB-INF\flex\services-config.xml

                                I assume you're following this example - http://www.adobe.com/devnet/flex/articles/helloworld.html

                                Check that your destination configuration matches the one in the devnet article.

                                (d) start the CF server

                                (e) Compile your mxml application via command-line or Flex Builder specifying the -services C:\Inetpub\wwwroot\WEB-INF\flex\services-config.xml

                                If services-config.xml include {context.root} or {context-root} tokens, you would also need to specify -context-root /

                                (f) Run your application.

                                It is not necessary to start up FDS if you are only using Remoting with CFCs.

                                Based on your information, I cannot spot anything explictly wrong. I've typed up the step-by-step instructions. Please go through and double-check each of your steps. Good luck.

                                - Cathy
                                • 13. Re: Error on HelloWorld Flex Application
                                  tedevang Level 1
                                  Thanks Cathy,

                                  I ended up reinstalling CF and everything worked fine after tat. Muhst have been some problem with the initial installation.

                                  -Ted