关于spring http invoker中一个常见错误,dubbo 调用 hibernate的set map list

最近有几个项目组在使用spring http invoker调用SSO远程接口时,发现一个错误。 
Java代码   收藏代码
  1. org.springframework.remoting.RemoteAccessException:   
  2. Could not deserialize result from HTTP invoker remote service [http://192.168.180.15:8080/spring-http-invoker/httpservice/userInfoService];  
  3. nested exception is java.io.InvalidClassException: org.hibernate.collection.AbstractPersistentCollection;   
  4. local class incompatible: stream classdesc serialVersionUID = -7982170513654570219, local class serialVersionUID = -5723701046347946317  

        经调查,这个是由于SSO的hibernate版本和某些新项目的hibernate版本不一致造成。 很多人都会奇怪,远程接口调用跟hibernate有什么关系。 
         其实是这样的: 
         远程方法返回的复杂对象中包含了set,  这个set一般是hibernate一对多关系从数据库中load出来的。虽然这个set定义的是java.util.set接口, 但是其实实例是:org.hibernate.collection. PersistentSet. 
        我们看一下org.hibernate.collection. PersistentSet 这个类的定义:
Java代码   收藏代码
  1. public class PersistentSet extends AbstractPersistentCollection  implements Set  
。 
         所以说传到客户端的对象中,其实是包含了PersistentSet,当客户端进行反序列化的时候,由于hibernate版本不一致, 导致报org.hibernate.collection.AbstractPersistentCollection 错误。 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值