Apache flex BlazeDS消息通道.Connect.Failed错误

Apache flex BlazeDS消息通道.Connect.Failed错误,apache-flex,blazeds,Apache Flex,Blazeds,我在互联网上搜索,任何关于这个错误的答案都不能解决我的问题 我在Openshift中有一台blazeds服务器,我正在通过FlashBuilder连接它。 我想制作一个应用程序,向使用我的应用程序的所有其他用户发送消息 我是说我有两份申请。一个将向服务器发送消息,这个将在桌面上,另一个是移动项目,将接收我通过服务器从桌面应用发送的消息 我尝试使用BlazeDS消息传递,但出现以下错误: (mx.messaging.messages::ErrorMessage)#0 body = (Objec

我在互联网上搜索,任何关于这个错误的答案都不能解决我的问题

我在Openshift中有一台blazeds服务器,我正在通过FlashBuilder连接它。 我想制作一个应用程序,向使用我的应用程序的所有其他用户发送消息

我是说我有两份申请。一个将向服务器发送消息,这个将在桌面上,另一个是移动项目,将接收我通过服务器从桌面应用发送的消息

我尝试使用BlazeDS消息传递,但出现以下错误:

(mx.messaging.messages::ErrorMessage)#0
  body = (Object)#1
  clientId = (null)
  correlationId = "96461BC6-7288-A95C-923B-B32FCDDC9CE3"
  destination = ""
  extendedData = (null)
  faultCode = "Client.Error.MessageSend"
  faultDetail = "Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: 'http://ainApp.swf/messagebroker/amfpolling'"
  faultString = "Send failed"
  headers = (Object)#2
  messageId = "147C1B6F-6877-79D8-3BCA-B32FCDF5E3F9"
  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://ainApp.swf/messagebroker/amfpolling"
      failoverURIs = (Array)#6
      id = "my-polling-amf"
      mpiEnabled = false
      netConnection = (flash.net::NetConnection)#7
        client = (mx.messaging.channels::AMFChannel)#4
        connected = false
        httpIdleTimeout = 0
        maxPeerConnections = 8
        objectEncoding = 3
        proxyType = "none"
        uri = "http://ainApp.swf/messagebroker/amfpolling"
      piggybackingEnabled = false
      polling = false
      pollingEnabled = true
      pollingInterval = 4000
      protocol = "http"
      reconnecting = false
      recordMessageSizes = false
      recordMessageTimes = false
      requestTimeout = -1
      uri = "http://{server.name}:{server.port}/messagebroker/amfpolling"
      url = "http://{server.name}:{server.port}/messagebroker/amfpolling"
      useSmallMessages = false
    channelId = "my-polling-amf"
    connected = false
    currentTarget = (mx.messaging.channels::AMFChannel)#4
    eventPhase = 2
    faultCode = "Channel.Connect.Failed"
    faultDetail = "NetConnection.Call.Failed: HTTP: Failed: url: 'http://ainApp.swf/messagebroker/amfpolling'"
    faultString = "error"
    reconnecting = false
    rejected = false
    rootCause = (Object)#8
      code = "NetConnection.Call.Failed"
      description = "HTTP: Failed"
      details = "http://ainApp.swf/messagebroker/amfpolling"
      level = "error"
    target = (mx.messaging.channels::AMFChannel)#4
    type = "channelFault"
  timestamp = 0
  timeToLive = 0
这是我试图从中发送消息的桌面应用程序:

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                       xmlns:s="library://ns.adobe.com/flex/spark" 
                       xmlns:mx="library://ns.adobe.com/flex/mx">
    <fx:Script>
        <![CDATA[
            import mx.messaging.events.ChannelEvent;
            import mx.messaging.events.MessageFaultEvent;
            import mx.messaging.messages.AsyncMessage;

            protected function cons_faultHandler(event:MessageFaultEvent):void
            {
                trace(event.message + ' fault')
            }

        ]]>
    </fx:Script>
    <fx:Declarations>
        <s:Consumer id="cons" destination="cricket"  message="messages.text += event.message.body.msg + '\n'" fault="cons_faultHandler(event)"/>
        <s:Producer id="prod" destination="cricket" fault="cons_faultHandler(event)" />
    </fx:Declarations>

    <s:VGroup verticalScrollPosition="0" horizontalScrollPosition="0">
        <s:TextArea id="messages" width="100%" height="50%"/>
        <s:TextInput id="mesgSender" />
        <s:Button id="send" label="send" click="prod.send(new AsyncMessage({msg:mesgSender.text+'asdasd'}))"/>
    </s:VGroup>

</s:WindowedApplication>

这是我的messaging-config.xml和services-config.xml:

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

    <services>
        <service-include file-path="remoting-config.xml" />
    </services>

    <security>
        <login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/>
    </security>

    <channels>

        <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
            <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
        </channel-definition>
    </channels>

    <logging>
        <target class="flex.messaging.log.ConsoleTarget" level="Error">
            <properties>
                <prefix>[BlazeDS] </prefix>
                <includeDate>false</includeDate>
                <includeTime>false</includeTime>
                <includeLevel>false</includeLevel>
                <includeCategory>false</includeCategory>
            </properties>
            <filters>
                <pattern>Endpoint.*</pattern>
                <pattern>Service.*</pattern>
                <pattern>Configuration</pattern>
            </filters>
        </target>
    </logging>

    <system>
        <redeploy>
            <enabled>false</enabled>
        </redeploy>
    </system>

</services-config>


<?xml version="1.0" encoding="UTF-8"?>
<service id="message-service" 
    class="flex.messaging.services.MessageService">

    <adapters>
        <adapter-definition id="actionscript" class="flex.messaging.services.messaging.adapters.ActionScriptAdapter" default="true" />
        <!-- <adapter-definition id="jms" class="flex.messaging.services.messaging.adapters.JMSAdapter"/> -->
    </adapters>

    <default-channels>
        <channel ref="my-polling-amf"/>
    </default-channels>

    <destination id="cricket">
        <channel ref="my-amf"/>
    </destination>

</service>

[布莱兹]
假的
假的
假的
假的
终点*
服务*
配置
假的
我不知道我做错了什么,也不知道为什么在错误消息中,端点url是“http://ainApp.swf/messagebroker/amfpolling". 顺便说一下,我的桌面应用程序名称是MainApp


感谢您在services-config.xml中定义频道url

url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf"
喜欢这个

url="/yourContextRootName/messagebroker/amf"
不要定义server.name和server.port,这会带来类似的问题