redis 报错 NoSuchFieldError: DEFAULT. redis netty
2021/9/29 19:41:57
本文主要是介绍redis 报错 NoSuchFieldError: DEFAULT. redis netty,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
redis 报错 NoSuchFieldError: DEFAULT
具体报错如下:
Exception in thread "main" java.lang.NoSuchFieldError: DEFAULT at io.lettuce.core.AbstractRedisClient.connectionBuilder(AbstractRedisClient.java:222) at io.lettuce.core.RedisClient.connectStatefulAsync(RedisClient.java:313) at io.lettuce.core.RedisClient.connectStandaloneAsync(RedisClient.java:278) at io.lettuce.core.RedisClient.connect(RedisClient.java:211) at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.lambda$getConnection$1(StandaloneConnectionProvider.java:115) at java.util.Optional.orElseGet(Optional.java:267) at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.getConnection(StandaloneConnectionProvider.java:115) at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1459) at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:1247) at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getConnection(LettuceConnectionFactory.java:1230) at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getSharedConnection(LettuceConnectionFactory.java:979) at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getConnection(LettuceConnectionFactory.java:359) at org.springframework.data.redis.core.RedisConnectionUtils.fetchConnection(RedisConnectionUtils.java:193) at org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:144) at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:105) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:209) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:189) at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:96) at org.springframework.data.redis.core.DefaultValueOperations.get(DefaultValueOperations.java:53) at com.dingxuan.sky.dxp.udp.client.SkyDxpUdpClientApplication.main(SkyDxpUdpClientApplication.java:21)
依赖版本
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> <version>2.4.5</version> </dependency> <!--redis 里面依赖了 lettuce的版本 ,如下图--> <dependency> <groupId>io.netty</groupId> <artifactId>netty-all</artifactId> <version>5.0.0.Alpha1</version> </dependency>
redis里面依赖了lettuce的版本,lettuce本身集成了netty 4.1 的版本,与项目本身集成的5.0 版本冲突。
解决办法:
-
将本身集成的netty的版本与lettuce的版本改成一致的。
-
去掉lettuce 改集成 jedis
依赖jedis版本需要查看 spring-boot-starter-data-redis 对应的jedis版本,2.4.5 默认对应 jedis 的 3.3.0版本
这篇关于redis 报错 NoSuchFieldError: DEFAULT. redis netty的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-12-27阿里云Redis学习入门指南
- 2024-12-27阿里云Redis入门详解:轻松搭建与管理
- 2024-12-27阿里云Redis学习:新手入门指南
- 2024-12-24Redis资料:新手入门快速指南
- 2024-12-24Redis资料:新手入门教程与实践指南
- 2024-12-24Redis资料:新手入门教程与实践指南
- 2024-12-07Redis高并发入门详解
- 2024-12-07Redis缓存入门:新手必读指南
- 2024-12-07Redis缓存入门:新手必读教程
- 2024-12-07Redis入门:新手必备的简单教程