标签:des style blog http io os ar 使用 java
今天在Flex中使用RemoteObject进行java调用时,报错
[RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404: url: ‘http://localhost:8080/UnitCity/messagebroker/amf‘"] ,于是百度之,网上说法很多,最多的是以下两种情况:
第一种情况:
[RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404: url: ‘http://localhost:8889/WebContent/messagebroker/amf‘"]
当url中是WebContent而不是工程名称时:这主要是因为Context root的设置问题,修改为工程名字即可;
方法:右键工程 - properties - flex server - Context root(/工程名)
第二种情况:
[RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404: url: ‘http://localhost:8080/UnitCity/messagebroker/amf‘"]
针对这种情况有人说是tomcat的问题,有人说是RemoteObject调用时需要添加endpoint="http://localhost:8080/项目名/messagebroker/amf">,例如
<mx:RemoteObject id="tPublicUserService" destination="tPublicUserService" endpoint="http://localhost:8080/项目名/messagebroker/amf">
</mx:RemoteObject>
而我在调用时已经配置了这个,但是依然有问题,那就是第三种情况了,
第三种情况(我的情况):
于是我继续查找,终于找到了原因:由于我在web.xml里只配置了flex监听,而忘了配置servlet;解决方法如下:
也有人说添加下面的也可以,具体没有测试:
<listener>
<listener-class>flex.messaging.HttpFlexSession</listener-class>
</listener>
<servlet>
<servlet-name>MessageBrokerServlet</servlet-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>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MessageBrokerServlet</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>
针对Flex+Java使用RemoteObject通讯 报错Channel.Connect.Failed error NetConnection.Call.Failed 404
标签:des style blog http io os ar 使用 java
原文地址:http://www.cnblogs.com/unitgis/p/4048318.html