本站首页    管理页面    写新日志    退出


«August 2025»
12
3456789
10111213141516
17181920212223
24252627282930
31


公告

戒除浮躁,读好书,交益友


我的分类(专题)

日志更新

最新评论

留言板

链接

Blog信息
blog名称:邢红瑞的blog
日志总数:523
评论数量:1142
留言数量:0
访问次数:9692040
建立时间:2004年12月20日




[j2ee]hessian的bug
原创空间,  文章收藏,  软件技术,  电脑与网络

邢红瑞 发表于 2008/5/20 12:16:06

人遇到一次bug不难,难的是每天遇到bug,竟然是同一个公司的不同产品的bug。使用hessian进行数据传输,网上下载了新的hessian 3.1.5.接口public interface BasicAPI {public String hello(String user); }实现public class BasicService implements BasicAPI {public String hello(String user) {   return "hello," + user + " !";} }spring的服务器端配置文件<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"       xmlns:util="http://www.springframework.org/schema/util"       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd  http://www.springframework.org/schema/util                     http://www.springframework.org/schema/util/spring-util-2.0.xsd">    <!-- 消息资源 -->    <bean id="messageSource"          class="org.springframework.context.support.ResourceBundleMessageSource">        <property name="basename">            <value>messages</value>        </property>    </bean>           <!--Request Mapping -->    <bean id="urlMapping"        class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">    </bean>          <bean id="helloService" class="com.xxx.BasicService"></bean>     <bean name="/hello.service" class="org.springframework.remoting.caucho.HessianServiceExporter">        <property name="service">            <ref bean="helloService" />        </property>        <property name="serviceInterface">            <value>com.xxx.BasicAPI</value>        </property>    </bean></beans>web.xml<servlet>        <servlet-name>service</servlet-name>        <servlet-class>            org.springframework.web.servlet.DispatcherServlet        </servlet-class>        <init-param>            <param-name>contextConfigLocation</param-name>            <param-value>classpath:service-servlet.xml</param-value>        </init-param>         <load-on-startup>2</load-on-startup>    </servlet>        <servlet-mapping>        <servlet-name>service</servlet-name>        <url-pattern>*.service</url-pattern>    </servlet-mapping>客户端的配置文件 hessianclient.xml<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"       xmlns:util="http://www.springframework.org/schema/util"       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd  http://www.springframework.org/schema/util                     http://www.springframework.org/schema/util/spring-util-2.0.xsd">  <bean id="helloService"    class="org.springframework.remoting.caucho.HessianProxyFactoryBean">        <property name="serviceUrl">            <value>                http://localhost/hello.service            </value>        </property>        <property name="serviceInterface">            <value>com.xxx.BasicAPI</value>        </property>    </bean></beans>测试用例import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext; public class HessianTest {     public HessianTest() {     }    public static void main(String[] args) {        String[] paths = {"hessianclient.xml"};        ApplicationContext ctx = new ClassPathXmlApplicationContext(paths);        BasicAPI hello = (BasicAPI) ctx.getBean("helloService");        System.out.println(hello.hello("dsdd"));    }}运行出现Caused by: com.caucho.hessian.io.HessianProtocolException: expected hessian reply at end of file?at com.caucho.hessian.io.Hessian2Input.error(Hessian2Input.java:2701)at com.caucho.hessian.io.Hessian2Input.startReply(Hessian2Input.java:405)at com.lizongbo.hessian.client.HessianProxy.invoke(HessianProxy.java:65) 因为对hessian协议定义不大理解,加上实现复杂,找了一个3.1.3用,以后替他修正这个bug,使用caucho的产品,坚决不用新的版本。


阅读全文(10998) | 回复(1) | 编辑 | 精华
 


回复:hessian的bug
原创空间,  文章收藏,  软件技术,  电脑与网络

华美汉盛(游客)发表评论于2008/5/29 16:58:19

楼主要找工作吗,到我们公司的blog看看,我们在招软件开发人员,高薪诚聘oracle人才


个人主页 | 引用回复 | 主人回复 | 返回 | 编辑 | 删除
 


» 1 »

发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.391 second(s), page refreshed 144765587 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号