本文来源: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进行数据传递时,需让作为消息传递的类序列化。
-
public class TaoResult<T> implements Serializable{
-
private long total;
-
private List<T> rows;
-
public long getTotal() {
-
return total;
-
}
-
public void setTotal(long total) {
-
this.total = total;
-
}
-
public List<T> getRows() {
-
return rows;
-
}
-
public void setRows(List<T> rows) {
-
this.rows = rows;
-
}