1. 現象
在學習Hessian時,A系統通過hessian去調用B,但收到500錯誤:
java.io.IOException: Server returned HTTP response code: 500 for URL
調試B,看到標題所述異常。
2. 分析
經過搜索,看到這樣的信息:
“是hessian和spring的版本不兼容引起的” http://itlab.idcquan.com/Java/base/849773_4.html
3. 原因
經過分析發現,B所使用的hessian是spring-remoting 2.0實現的,所使用的類是org.springframework.remoting.caucho.HessianServiceExporter,而從2.5開始,spring-remoting的內容被拆分到spring-webmvc或spring-web中。
A所使用的是spring-web 4.2.1.final,所使用的類是org.springframework.remoting.caucho.HessianProxyFactoryBean
4. 解決辦法
在B中放棄使用spring-remoting 2.0, 而是使用spring-web 4.2.1.final.
