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

  • Post author:
  • Post category:java




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;
	}
	
}



版权声明:本文为kye055947原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。