簡體   English   中英

BlazeDS消息通道。連接失敗錯誤

[英]BlazeDS Messaging Channel.Connect.Failed Error

我通過互聯網搜索,此錯誤的任何答案都無法解決我的問題。

我在Openshift中有一台服務器,並且正在通過Flash Builder連接到該服務器。 我想制作一個向所有其他使用我的應用程序的用戶發送消息的應用程序。

我的意思是我有2個申請。 一個將向服務器發送消息,而另一個將在桌面上,另一個是移動項目,並將接收我從桌面應用程序通過服務器發送的消息。

我試圖使用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="http://{server.name}:{server.port}/{context.root}/messagebroker/amf"

喜歡這個

url="/yourContextRootName/messagebroker/amf"

不要定義server.name和server.port,它具有類似的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM