主要報錯內容:
Caused by: org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 10.0.023.3:6379
Caused by: io.lettuce.core.RedisConnectionException: Unable to connect to 10.0.023.3:6379
追蹤問題一直以為redis密碼錯誤,最好嘗試很多辦法依舊沒有解決,使用jedis連接卻是正常的!!!
解決辦法最后在redis 官網問題反饋里找到了答案:
因為使用的spring boot 高版本導致的
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.5.6</version> <relativePath/> </parent>
高版本的存在bug 官方也沒有進行修復
<dependency> <groupId>io.lettuce</groupId> <artifactId>lettuce-core</artifactId> </dependency>
降低版本就行了
<dependency> <groupId>io.lettuce</groupId> <artifactId>lettuce-core</artifactId> <version>5.3.7.RELEASE</version> </dependency>
問題已解決