Caused by: java.lang.IllegalStateException: Serialized class cn.bloghut.dto.ProducterDto must implem

Posted 闲言_

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Caused by: java.lang.IllegalStateException: Serialized class cn.bloghut.dto.ProducterDto must implem相关的知识,希望对你有一定的参考价值。

错误产生环境

使用zookeeper+dubbo进行远程调用时产生

错误描述

 Caused by: java.lang.IllegalStateException: Serialized class cn.bloghut.dto.ProducterDto must implement java.io.Serializable
 org.apache.dubbo.remoting.RemotingException: io.netty.handler.codec.EncoderException: java.lang.IllegalStateException: Serialized class cn.bloghut.dto.ProducterDto must implement java.io.Serializable
io.netty.handler.codec.EncoderException: java.lang.IllegalStateException: Serialized class cn.bloghut.dto.ProducterDto must implement java.io.Serializable
	at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:125)
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717)
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:709)
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:792)
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:702)
	at io.netty.handler.timeout.IdleStateHandler.write(IdleStateHandler.java:304)
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717)
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:709)
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:792)
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:702)
	at io.netty.channel.ChannelDuplexHandler.write(ChannelDuplexHandler.java:115)

在这里插入图片描述

错误原因

实体类没有序列化 ,导致的

  • 序列化:将java对象转换为二进制,用于保存或者网络传输
在这里插入代码片

解决办法

java实体类需要实现Serializable 接口

以上是关于Caused by: java.lang.IllegalStateException: Serialized class cn.bloghut.dto.ProducterDto must implem的主要内容,如果未能解决你的问题,请参考以下文章

Caused by: org.jboss.netty.channel.ChannelException: Failed to bind to: /0.0.0.0:20880 Caused by: ja

Mathematical Problems Caused by CCD

Caused by SSLError

Caused by: java.lang.NoClassDefFoundError:

caused by a circular import.

异常Caused by: java.lang.ClassNotFoundException: org.springframework.dao.DataIntegrityViolationExcep