flex与java  RemoteObject 通讯 部署时出现了 这个问题:

连接失败(mx.messaging.messages::ErrorMessage)#0
  body = (Object)#1
  clientId = (null)
  correlationId = "F545ECB2-5C82-C01A-30A9-5059C14B3D79"
  destination = ""
  extendedData = (null)
  faultCode = "Client.Error.MessageSend"
  faultDetail = "Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404: url: 'http://localhost/ServerPlugins/messagebroker/amf'"
  faultString = "发送失败"
  headers = (Object)#2
  messageId = "58B27F6E-5D97-A286-8D31-5059CA73F7A4"
  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/ServerPlugins/messagebroker/amf"
      failoverURIs = (Array)#6
      id = "my-amf"
      mpiEnabled = false
      netConnection = (flash.net::NetConnection)#7
        client = (mx.messaging.channels::AMFChannel)#4
        connected = false
        maxPeerConnections = 8
        objectEncoding = 3
        proxyType = "none"
        uri = "http://localhost/ServerPlugins/messagebroker/amf"
      piggybackingEnabled = false
      polling = false
      pollingEnabled = true
      pollingInterval = 3000
      protocol = "http"
      reconnecting = false
      recordMessageSizes = false
      recordMessageTimes = false
      requestTimeout = -1
      uri = "http://{server.name}:{server.port}/ServerPlugins/messagebroker/amf"
      url = "http://{server.name}:{server.port}/ServerPlugins/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: Status 404: url: 'http://localhost/ServerPlugins/messagebroker/amf'"
    faultString = "error"
    reconnecting = false
    rejected = false
    rootCause = (Object)#8
      code = "NetConnection.Call.Failed"
      description = "HTTP: Status 404"
      details = "http://localhost/ServerPlugins/messagebroker/amf"
      level = "error"
    target = (mx.messaging.channels::AMFChannel)#4
    type = "channelFault"
  timestamp = 0
  timeToLive = 0

 

解决方案:将java工程中的ServerPlugins\WebContent\WEB-INF\flex\services-config.xml里面的 

<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">

原有的写法:<endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
   改为:  <endpoint url="http://{server.name}:{server.port}/java端的工程名/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
        </channel-definition>

flex端的路径为:



还需要在tomcat下的root目录下加入

crossdomain.xml 文件

<?xml version="1.0"?>  
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">  
<cross-domain-policy> <site-control permitted-cross-domain-policies="all" />  
  <allow-access-from domain="*" />  
  <allow-http-request-headers-from domain="*" headers="*"/>  
</cross-domain-policy> 

posted on 2012-01-13 10:46  星^_^風  阅读(669)  评论(0编辑  收藏  举报