当前位置:   article > 正文

升级Redisson版本兼容问题_升级redisson的版本和netty的版本

升级redisson的版本和netty的版本

升级版本:从 3.10.6 升级到3.18.0

报错: java.io.IOException: Unsupported protocol version 252
  1. java.io.IOException: Unsupported protocol version 252
  2. at org.jboss.marshalling.river.RiverUnmarshaller.start(RiverUnmarshaller.java:1375)
  3. at org.redisson.codec.MarshallingCodec.lambda$new$0(MarshallingCodec.java:145)
  4. at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:383)
  5. at org.redisson.client.handler.CommandDecoder.decodeCommand(CommandDecoder.java:198)
  6. at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:137)
  7. at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:113)
  8. at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:507)
  9. at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366)
  10. at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
  11. at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
  12. at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
  13. at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
  14. at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
  15. at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
  16. at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
  17. at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
  18. at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
  19. at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)
  20. at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
  21. at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
  22. at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
  23. at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
  24. at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
  25. at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
  26. at java.lang.Thread.run(Thread.java:750)
问题原因:

版本: 3.10.6 默认使用了FstCodec 编码

3.18.0 默认编码使用:MarshallingCodec,官方已经明确不再建议使用 FstCodec编码,并且移除了Fst相关依赖

若希望继续兼容老的编码方式,进行以下步骤:

  1. <dependency>
  2. <groupId>de.ruedigermoeller</groupId>
  3. <artifactId>fst</artifactId>
  4. <version>2.57</version>
  5. </dependency>

增加自定义编码

  1. @Bean
  2. public RedissonAutoConfigurationCustomizer redissonAutoConfigurationCustomizer(){
  3. return config -> {
  4. config.setCodec(new FstCodec());
  5. };
  6. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/815196
推荐阅读
  

闽ICP备14008679号