执行graniteDS的AMF消息错误java.io.EOFException

时间:2013-09-03 21:16:04

标签: hibernate flex spring-mvc cairngorm graniteds

希望有人能帮助我。

我正在开发一个项目,在后端使用Spring MVC + Hibernate + Tomcat 7,在前端使用blazeDS + Cairngorm,我们需要从blazeDS迁移到graniteDS但是我有一个:Channel.Connect.Failed错误NetConnection .Call.Failed:HTTP:状态500,当尝试连接后端,并在tomcat控制台中:

错误AMFMessageFilter:160 - AMF消息错误 java.io.EOFException的     在java.io.DataInputStream.readUnsignedShort

我不明白我在这里缺少什么,我一直在互联网上看,我找到的最有代表性的资源就是这些:http://www.graniteds.org/public/docs/3.0.0/docs/reference/flex/en-US/html/index.htmlhttp://narup.blogspot.com/2008/08/getting-started-project-graniteds-with.html

提前感谢!

这里是我的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee       

http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
 version="2.4">

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>

<listener>
<listener-class>com.bamboo.common.factory.Log4JContextListener</listener-class>
</listener>

<!-- Spring listener -->
<listener>
 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-

class>
</listener>


<!-- read services-config.xml file at web application startup   -->
<listener>

<listener-class>org.granite.config.GraniteConfigListener</listener-class>

</listener>

<!-- Spring listener for web-scopes (request, session)  -->
<listener>
<listener-class>
    org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>


<!-- handle AMF requests ([de]serialization)  -->
<filter>

<filter-name>AMFMessageFilter</filter-name>

<filter-class>org.granite.messaging.webapp.AMFMessageFilter</filter-class>

</filter>

<filter-mapping>

<filter-name>AMFMessageFilter</filter-name>

<url-pattern>/graniteamf/*</url-pattern>

</filter-mapping>

<servlet>

<servlet-name>dispatcher</servlet-name>
<servlet-class>
    org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>


<!-- handle AMF requests (execution)  -->
<servlet>

<servlet-name>AMFMessageServlet</servlet-name>

<servlet-class>org.granite.messaging.webapp.AMFMessageServlet</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>AMFMessageServlet</servlet-name>

<url-pattern>/graniteamf/*</url-pattern>

</servlet-mapping>

</web-app>

和services-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<services-config>

<services>
<service-include file-path="remoting-config.xml" />
</services>

<factories>

<factory id="springFactory" class="org.granite.spring.SpringServiceFactory" />

</factories>
<channels>

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

    <endpoint url="http://{server.name}:{server.port}/{context.root}/graniteamf/amf"  

class="flex.messaging.endpoints.AMFEndpoint"/>
</channel-definition>
</channels>
</services-config>

remote-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<service  id="remoting-service" 
class="flex.messaging.services.RemotingService"  

messageTypes="flex.messaging.messages.RemotingMessage" >

<destination id="remoteObject-destination">      
    <channels>
        <channel ref="my-amf"/>
    </channels>
    <properties>
        <factory>springFactory</factory>
        <source>catalogFacade</source>
        <scope>application</scope>        
    </properties>
</destination>

</service>

1 个答案:

答案 0 :(得分:0)

看起来你有一个反序列化问题。堆栈表示它正在尝试从AMF中读取未签名的短消息,但它不能因为流没有更多的字节要读取。 (基本上尝试从AMF中读取更多数据而不是它包含的内容)您的java类和AS3类不同步。您是否修改了java类并忘记使用花花公子插件(或maven插件)重新生成AS3文件?在没有重新生成的情况下在java端添加字段可能是原因。

Granite序列化系统基于AS3方面的IExternalizable:它是显式的(与BlazeDS有很大不同,BlazeDS可以在运行时调整数据,例如可以在运行时转换类型字段)。

检查您的AS3文件的生成以及最终的花岗岩服务器配置。