升级Redisson版本兼容问题

升级版本:从 3.10.6 升级到3.18.0

报错: java.io.IOException: Unsupported protocol version 252
java.io.IOException: Unsupported protocol version 252
        at org.jboss.marshalling.river.RiverUnmarshaller.start(RiverUnmarshaller.java:1375)
        at org.redisson.codec.MarshallingCodec.lambda$new$0(MarshallingCodec.java:145)
        at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:383)
        at org.redisson.client.handler.CommandDecoder.decodeCommand(CommandDecoder.java:198)
        at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:137)
        at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:113)
        at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:507)
        at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:750)
问题原因:

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

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

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

XML 复制代码
<dependency>
    <groupId>de.ruedigermoeller</groupId>
    <artifactId>fst</artifactId>
    <version>2.57</version>
</dependency>

增加自定义编码

java 复制代码
@Bean
public RedissonAutoConfigurationCustomizer redissonAutoConfigurationCustomizer(){
    return config -> {
        config.setCodec(new FstCodec());
    };
}
相关推荐
everyStudy23 分钟前
JS中判断字符串中是否包含指定字符
开发语言·前端·javascript
城南云小白24 分钟前
web基础+http协议+httpd详细配置
前端·网络协议·http
前端小趴菜、24 分钟前
Web Worker 简单使用
前端
luthane25 分钟前
python 实现average mean平均数算法
开发语言·python·算法
web_learning_32127 分钟前
信息收集常用指令
前端·搜索引擎
码农研究僧30 分钟前
Flask 实现用户登录功能的完整示例:前端与后端整合(附Demo)
python·flask·用户登录
Ylucius32 分钟前
动态语言? 静态语言? ------区别何在?java,js,c,c++,python分给是静态or动态语言?
java·c语言·javascript·c++·python·学习
tabzzz34 分钟前
Webpack 概念速通:从入门到掌握构建工具的精髓
前端·webpack
凡人的AI工具箱44 分钟前
AI教你学Python 第11天 : 局部变量与全局变量
开发语言·人工智能·后端·python
200不是二百1 小时前
Vuex详解
前端·javascript·vue.js