`
flyer2010
  • 浏览: 356049 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

hessian 使用过程碰到的异常

阅读更多
今天在使用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 code
	at 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 code
	at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:266)
	... 2 more

spring2.5.6不支持hessian过高版本,最后只好换成在web.xml中配置hessian的访问地址
分享到:
评论
1 楼 王佳伟 2015-03-13  
改成不用spring整合的方式配置请求地址就不会报这个错了是嘛?
还有spring3.1.3是否支持hessian4.0.7?

相关推荐

Global site tag (gtag.js) - Google Analytics