flex与java交互出现Channel.Connect.Failed error NetConnection.Call.BadVersion: : url
flex与java交互出现Channel.Connect.Failed error NetConnection.Call.BadVersion: : url:
近期在做flex开发,过程中需要与java服务端进行交互,而服务端采用spring3.2+struts2搭建,并且通过blazeds与flex客户端通信。过程中采用了spring-flex1.0.3.jar ,使用maven进行管理,自动会依赖相关jar,这里不详述。
主要是在通信过程中,通过flex客户端访问服务端是发生了异常 send Failed,这个异常只在页面进行了提示,详细的信息通过debug查看到如下:
Channel.Connect.Failed error NetConnection.Call.BadVersion: : url:'http://localhost:8080/manualdrived-designer/messagebroker/amf'。
于是查找原因,后直接通过以上url进行访问,出现了500错误。想到可能是由于权限导致。
于是在spring的配置文件中添加匿名权限,/messagebroker/**=anon。再访问就可以了。下参考:
<!-- 自定义filterChainDefinitions --> <bean id="menuFilterChainDefinition" class="com.cattsoft.system.security.MenuFilterChainDefinition"> <property name="filterChainDefinitions"> <!-- 此部分的filterChain将加载在最前面 --> <value> /static/** = anon /themes/** = anon /flex/** = anon /messagebroker/**=anon /index.jsp = anon / = anon /main!index = anon /main!login = authc /main!verifycode = anon /main!home = authc /main!logout = authc </value> </property> <property name="finalFilterChainDefinitions"> <!-- 此部分的filterChain将加载在最后面 --> <value> /** = authc </value> </property> </bean>
另外如果添加了以上访问后依然存在错误,debug后出现404,通过url直接访问也是404,且提示错误为:
HTTP Status 404 - There is no Action mapped for action name messagebroker.
那么可能是因为采用struts2的注解方式将所有的访问默认都映射成了action,这样就需要在struts.xml中配置
<constant name="struts.action.excludePattern" value="/messagebroker/amf/*.*" /> 使其不背struts2管理