6 Replies Latest reply on Mar 10, 2011 12:43 PM by Cr99

    Flex remoting stopped working

    Cr99 Level 1

      I set up my app to communicate with the java backend via remoting but it was over two years ago and I'm having to come back to this project to do some updates.  In the meantime the code got transferred to another machine and though I think the code is essentially the same, I think something in the configuration must have gotten messed up in the transfer.  I have the remoting-config.xml file set up properly and in the right directory and on the surface it looks like it all should work, but I'm getting the following error when I try to access my remote Java methods:

       

      (mx.messaging.messages::ErrorMessage)#0

        body = (Object)#1

        clientId = (null)

        correlationId = "1AF907E1-623C-B0C1-4B9B-973C16D76430"

        destination = ""

        extendedData = (null)

        faultCode = "Client.Error.MessageSend"

        faultDetail = "Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: 'http://localhost:8888/messagebroker/amf'"

        faultString = "Send failed"

        headers = (Object)#2

        messageId = "56B04B90-6882-0302-97CC-973C1756A591"

        rootCause = (mx.messaging.events::ChannelFaultEvent)#3

          bubbles = false

          cancelable = false

          channel = (mx.messaging.channels::AMFChannel)#4

            authenticated = false

            channelSets = (Array)#5

            connected = false

            connectTimeout = -1

            enableSmallMessages = true

            endpoint = "http://localhost:8888/messagebroker/amf"

            failoverURIs = (Array)#6

            id = "my-amf"

            mpiEnabled = false

            netConnection = (flash.net::NetConnection)#7

              client = (mx.messaging.channels::AMFChannel)#4

              connected = false

              objectEncoding = 3

              proxyType = "none"

              uri = "http://localhost:8888/messagebroker/amf"

            piggybackingEnabled = false

            polling = false

            pollingEnabled = false

            pollingInterval = 3000

            protocol = "http"

            reconnecting = false

            recordMessageSizes = false

            recordMessageTimes = false

            requestTimeout = -1

            uri = "http://{server.name}:{server.port}/messagebroker/amf"

            url = "http://{server.name}:{server.port}/messagebroker/amf"

            useSmallMessages = false

          channelId = "my-amf"

          connected = false

          currentTarget = (mx.messaging.channels::AMFChannel)#4

          eventPhase = 2

          faultCode = "Channel.Connect.Failed"

          faultDetail = "NetConnection.Call.Failed: HTTP: Failed: url: 'http://localhost:8888/messagebroker/amf'"

          faultString = "error"

          reconnecting = false

          rejected = false

          rootCause = (Object)#8

            code = "NetConnection.Call.Failed"

            description = "HTTP: Failed"

            details = "http://localhost:8888/messagebroker/amf"

            level = "error"

          target = (mx.messaging.channels::AMFChannel)#4

          type = "channelFault"

        timestamp = 0

        timeToLive = 0

          

        • 1. Re: Flex remoting stopped working
          snkd Level 1

          In your remote call set the endpoint property as follows

           

                  <services:FxxxSRV
                      id="fxxxSRV"
                      endpoint="http://localhost:8888/messagebroker/amf'"
                      fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                      showBusyCursor="true"/>

           

          and make sure in browser http://localhost:8888/messagebroker/amf will give you white screen..

          • 2. Re: Flex remoting stopped working
            Cr99 Level 1

            Thanks for the reply.  Unfortunately the amf link gives me

            404 Not Found

            Resource /messagebroker/amf not found on this server

             

            So something in the config must have changed.  But I have not changed them, so I don't know why it's not working.  Here is the relevant definition of the method I'm calling from remoting-config.xml

             

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

            <service id="remoting-service"

                class="flex.messaging.services.RemotingService">

             

                <adapters>

                    <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>

                </adapters>

             

                <default-channels>

                    <channel ref="my-amf"/>

                </default-channels>

             

            <!-- java class I'm calling -->

            <destination id="reportLoad">

                    <properties>

                        <source>factory.ReportLoad</source>

                    </properties>

                </destination>

             

            </service>

            • 3. Re: Flex remoting stopped working
              Cr99 Level 1

              By the way, as this is old code, I'm still using Flex 3.5.  Also, the failure is occurring with the following remote object:

               

              <mx:RemoteObject id="reportRetrieval" destination="reportLoad" showBusyCursor="true" fault="faultHandler(event)">

              <mx:method name="getReportData" result="getReportResults(event)"/>

              <mx:method name="getReportReload" result="getReloadResults(event)"/>

              <mx:method name="saveAllImages" result="showAllImages(event)"/>

              <mx:method name="getChartReload" result="getChartReloadResults(event)"/>

              <mx:method name="getFilePath" result="filePathResult(event)"/>

              </mx:RemoteObject>

              • 4. Re: Flex remoting stopped working
                Cr99 Level 1

                I have this code working on an old machine and I have run diff on the config files and everything is the same.  The directory structure is the same as well.  I even tried to bring up http://localhost:8888/messagebroker/amf on the one where the code is working and it also gave me the 404 error.  Unfortunately, the code on the old machine is an old version and there are so many files that have been changed it would be really painful to try and pull the new files back onto the old machine so I really need to figure out why remoting is not working.

                • 5. Re: Flex remoting stopped working
                  Cr99 Level 1

                  Well, I found out something interesting in the Properties for this project.  Under Flex Compiler > Additional Arguments, I noticed that it had:

                   

                  -services "/Dev/tomcat/ver/webapps/plan/myproj/WEB-INF/flex/services-config.xml" -locale en_US

                   

                  And this was the wrong path!  So I switched it back to the right path but it still doesn't work.  So what happened I think is that this app was originally developed for the oc4j (oracle) java server but I later did some development on this machine with tomcat and installed tomcat as a server in Flashbuilder so I'll bet that Flashbuilder is compiling it for tomcat somehow.  Could that be the problem?  If so, does anyone know how I get it to point to the oc4j server?  Or if not, what am I doing wrong?

                  • 6. Re: Flex remoting stopped working
                    Cr99 Level 1

                    Ok, I got it!

                     

                    In the Properties panel under Flex Server, it was set to tomcat there as well!  So I had to go in and change Root folder, Root URL, and Context root as well.

                     

                    Phew!  I'm glad that's fixed!