论坛首页 编程语言技术论坛

配置错误导致的flex不能与Java交互

浏览 4243 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2009-06-24   最后修改:2009-08-26

在JavaEE应用中,访问flex生成的flash,如

http://localhost:8002/flex/FundValue.swf?userName=sysuxk&startDate=2008-1-1&endDate=2009-6-20,发生错误

 

错误信息为:

[RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404: url: 'http://localhost:8002/messagebroker/amf'"]

       at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:220]

       at mx.rpc::Responder/fault()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:53]

       at mx.rpc::AsyncRequest/fault()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:103]

       at mx.messaging::ChannelSet/faultPendingSends()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\ChannelSet.as:1482]

       at mx.messaging::ChannelSet/channelFaultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\ChannelSet.as:975]

       at flash.events::EventDispatcher/dispatchEventFunction()

       at flash.events::EventDispatcher/dispatchEvent()

       at mx.messaging::Channel/connectFailed()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\Channel.as:997]

       at mx.messaging.channels::PollingChannel/connectFailed()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\channels\PollingChannel.as:354]

       at mx.messaging.channels::AMFChannel/statusHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\channels\AMFChannel.as:390]

 

重要信息为第一行:

[RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404: url: 'http://localhost:8002/messagebroker/amf'"]

Google一下,网上大致意见是http://localhost:8002/messagebroker/amf的地址错误,于是检查配置,发现无误。

由于错误中有提及HTTP: Status 404,故用浏览器访问http://localhost:8002/messagebroker/amf,结果为:

 

 

即该servlet未生效,不能访问。

web.xml中配置为:

    <!-- MessageBroker Servlet -->

    <servlet>

       <servlet-name>MessageBrokerServlet</servlet-name>

       <display-name>MessageBrokerServlet</display-name>

       <servlet-class>

           flex.messaging.MessageBrokerServlet

       </servlet-class>

       <init-param>

           <param-name>services.configuration.file</param-name>

           <param-value>/WEB-INF/flex/services-config.xml</param-value>

       </init-param>

       <load-on-startup>5</load-on-startup>

    </servlet>

 

    <servlet-mapping>

       <servlet-name>MessageBrokerServlet</servlet-name>

       <url-pattern>/messagebroker/*</url-pattern>

    </servlet-mapping>

于是检查/WEB-INF/flex/services-config.xml,并检查到remoting-config.xml,该配置文件作用是定义flex中用到的java类,发现中有:

    <destination id="myJavaClassRemoteObject">

       <properties>

           <source>flex.SayHelloService</source>

           <scope>application</scope>

       </properties>

    </destination>

配置的flex.SayHelloServicesvn中找不到。

 

于是问题原因是:remoting-config.xml中提及的Java类在本地部署系统中找不到,导致MessageBrokerServlet初始化失败,访问不了,从而flexJava的交互失败。故在出现RPC Fault错误时,第一步应检查http://localhost:8002/messagebroker/amf是否可以访问,并排查xml文件的配置错误。

  • 大小: 11.9 KB
  • 大小: 38.1 KB
论坛首页 编程语言技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics