报错
消费方调用rpc pb序列化报错如下:
代码语言:javascript复制ExecutionException: java.lang.RuntimeException: io.netty.handler.codec.EncoderException: java.lang.IllegalStateException: io.protostuff.runtime.Runti
meUnsafeFieldFactory$9$1@254189a5 and io.protostuff.runtime.RuntimeUnsafeFieldFactory$9$1@5b03de85 cannot have the same number.
io.netty.handler.codec.EncoderException: java.lang.IllegalStateException: io.protostuff.runtime.RuntimeUnsafeFieldFactory$9$1@254189a5 and io.protostuff.runt
ime.RuntimeUnsafeFieldFactory$9$1@5b03de85 cannot have the same number.
at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:125)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:749)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:741)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:827)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:734)
at io.netty.handler.timeout.IdleStateHandler.write(IdleStateHandler.java:286)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:749)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:741)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:827)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:734)
at io.netty.channel.ChannelDuplexHandler.write(ChannelDuplexHandler.java:106)
at org.apache.dubbo.remoting.transport.netty4.NettyClientHandler.write(NettyClientHandler.java:87)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:749)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:741)
at io.netty.channel.AbstractChannelHandlerContext.access$1900(AbstractChannelHandlerContext.java:39)
at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.write(AbstractChannelHandlerContext.java:1100)
at io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:1147)
at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:1089)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:418)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:454)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: io.protostuff.runtime.RuntimeUnsafeFieldFactory$9$1@254189a5 and io.protostuff.runtime.RuntimeUnsafeFieldFactory$
9$1@5b03de85 cannot have the same number.
at io.protostuff.runtime.ArrayFieldMap.<init>(ArrayFieldMap.java:44)
at io.protostuff.runtime.RuntimeSchema.createFieldMap(RuntimeSchema.java:381)
at io.protostuff.runtime.RuntimeSchema.<init>(RuntimeSchema.java:360)
at io.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:282)
at io.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:187)
源码 及 解决
可以看到,在循环字段的时候,如果filed数组不为空,那么说明编号重复。 反查代码:有两个一样的编号。