dubbo调用服务出现如下异常Serialized class com.taotao.manager.pojo.TaoResult must implement java.io.Serializabl

本文来源:https://blog.csdn.net/kye055947/article/details/77531824  如有不当之处,请告知删除。

20880-thread-4] [com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec]-[WARN]  [DUBBO] Fail to encode response: Response [id=2, version=2.0.0, status=20, event=false, error=null, result=RpcResult [result=com.taotao.manager.pojo.TaoResult@1e6db3f, exception=null]], send bad_response info instead, cause: Serialized class com.taotao.manager.pojo.TaoResult must implement java.io.Serializable, dubbo version: 2.5.3, current host: 127.0.0.1

 

 

 

解决方案:使用Dubbo进行数据传递时,需让作为消息传递的类序列化。

 

  1. public class TaoResult<T> implements Serializable{

  2.  
  3. private long total;

  4. private List<T> rows;

  5. public long getTotal() {

  6. return total;

  7. }

  8. public void setTotal(long total) {

  9. this.total = total;

  10. }

  11. public List<T> getRows() {

  12. return rows;

  13. }

  14. public void setRows(List<T> rows) {

  15. this.rows = rows;

  16. }

  17.  
  18.  

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值