六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 138|回复: 0

hessian 使用过程碰到的异常

[复制链接]

升级  50%

3

主题

3

主题

3

主题

童生

Rank: 1

积分
25
 楼主| 发表于 2013-1-29 22:41:38 | 显示全部楼层 |阅读模式
今天在使用hessian时碰到了如下的问题:
org.springframework.remoting.RemoteAccessException: Cannot access Hessian remote service at [http://localhost:8080/logcenter/remoting/hessianQueryLog]; nested exception is com.caucho.hessian.io.HessianProtocolException: expected hessian reply at end of file?at org.springframework.remoting.caucho.HessianClientInterceptor.convertHessianAccessException(HessianClientInterceptor.java:254)at org.springframework.remoting.caucho.HessianClientInterceptor.invoke(HessianClientInterceptor.java:225)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)at $Proxy1.queryLogItemByIdForHessian(Unknown Source)at com.xiu.log.qatest.LogHessianTest.main(LogHessianTest.java:55)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.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:218)at $Proxy0.queryLogItemByIdForHessian(Unknown Source)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at org.springframework.remoting.caucho.HessianClientInterceptor.invoke(HessianClientInterceptor.java:219)... 4 more
这是因为接口中出现方法重载,在调用时,服务器端会跑出异常。
在整合spring中,在客户端的配置里面加上如下代码可以解决:
<property name="overloadEnabled" value="true"></property>

spring2.5.6 + hessian 4.0.1,采用remoting-servlet.xml的方式进行配置,客户端调用时出现如下错误,换成hessian 3.1.5就正常了。
Exception in thread "main" com.caucho.hessian.client.HessianRuntimeException: com.caucho.hessian.io.HessianProtocolException: '?' is an unknown codeat com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:268)at $Proxy0.queryBusicardsTest(Unknown Source)at client.UserSimpleTest.main(UserSimpleTest.java:21)Caused by: com.caucho.hessian.io.HessianProtocolException: '?' is an unknown codeat com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:266)... 2 more
spring2.5.6不支持hessian过高版本,最后只好换成在web.xml中配置hessian的访问地址
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表