2012-12-19 14 views
0

我通過互聯網搜索和任何回答這個錯誤無法解決我的問題。BlazeDS消息Channel.Connect.Failed錯誤

我在Openshift有一個blazeds服務器,我通過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> 

這是我的消息-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> 

我不知道我做錯了一nd爲什麼在錯誤消息中,端點URL是「http://ainApp.swf/messagebroker/amfpolling」。順便說一下,我的桌面應用程序名稱是MainApp。

感謝

回答

0

在services-config.xml中你應該定義你的頻道網址。

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

喜歡這個

url="/yourContextRootName/messagebroker/amf" 

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