Springboot 2.6集成redis maven报错的坑记录
Springboot 2.6集成redis maven报错
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency>
当加这个配置后,POM.xml的第一行总是报错:
Description Resource Path Location Type
io.lettuce:lettuce-core:jar:6.1.8.RELEASE failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact io.lettuce:lettuce-core:jar:6.1.8.RELEASE from/to central (https://repo.maven.apache.org/maven2): The operation was cancelled.org.eclipse.aether.transfer.ArtifactTransferException: io.lettuce:lettuce-core:jar:6.1.8.RELEASE failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact io.lettuce:lettuce-core:jar:6.1.8.RELEASE from/to central (https://repo.maven.apache.org/maven2): The operation was cancelled.
at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:225)
at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:189)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:574)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:484)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:402)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:229)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:340)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:191)
at org.apache.maven.project.DefaultProjectBuilder.resolveDependencies(DefaultProjectBuilder.java:227)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:200)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:124)
看了意思是获取不到最新包,因为maven之前已经下载过,需要删除m2库里的最新玩意,
找到自己仓库,我的是C:\users\ckw\.m2\repository>,
在这个目录下,打开cmd,执行:
for /r %i in (*.lastUpdated) do del %i
执行这个批处理,
删完后,按下面图,update一把就好了
SpringBoot集成Redis连接不上
问题描述
初学SpringBoot
当进行SpringBoot集成Redis时。测试向redis中添加String类型的数据,key=name , value = zlw
。
但出现了一下错误:(Whitelabel Error Page)
看控制台输出发现,大致应该是redis没有连接成功。
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 192.168.86.129/<unresolved>:6379] with root cause
上网搜索了好多这个问题的错误,但好像都没有解决,不是自己的错误,但后来回想到,学习linux的时候,想要连接成功必须要关闭linux的防火墙才行。。。
试一试
可以看到防火墙已经关闭了,
哇~有新发现了,,虽然页面还是没有变化,但控制台的信息发生了变化。
提示:
WRONGPASS invalid username-password pair or user is disabled.
这应该是我的redis密码有问题。。
原来是我的密码加上了引号
记住:密码要去掉引号!!!
去掉双引号之后再次访问,成功!!
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。
- springboot连接redis并动态切换database的实现方法
- springboot 如何使用jedis连接Redis数据库
- 关于Springboot2.x集成lettuce连接redis集群报超时异常Command timed out after 6 second(s)
- springboot连接Redis的教程详解
- springboot2整合redis使用lettuce连接池的方法(解决lettuce连接池无效问题)
- Springboot2.X集成redis集群(Lettuce)连接的方法
- 解决spirngboot连接redis报错:READONLY You can‘t write against a read only replica的问题
相关文章
Spring中的@ExceptionHandler异常拦截器
这篇文章主要介绍了Spring中的@ExceptionHandler异常拦截器,Spring的@ExceptionHandler可以用来统一处理方法抛出的异常,给方法加上@ExceptionHandler注解,这个方法就会处理类中其他方法抛出的异常,需要的朋友可以参考下2024-01-01IntelliJ IDEA 好用插件之analyze inspect code详解
这篇文章主要介绍了IntelliJ IDEA 好用插件之analyze inspect code的相关知识,本文通过图文并茂的形式给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧2020-12-12SpringBoot整合Mybatis-Plus、Jwt实现登录token设置
Spring Boot整合Mybatis-plus实现登录常常需要使用JWT来生成用户的token并设置用户权限的拦截器,本文就来详细的介绍一下,具有一定的参考价值,感兴趣的可以了解一下2024-02-02解决springboot的JPA在Mysql8新增记录失败的问题
这篇文章主要介绍了解决springboot的JPA在Mysql8新增记录失败的问题,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教2021-06-06SpringSecurity安全框架在SpringBoot框架中的使用详解
在Spring Boot框架中,Spring Security是一个非常重要的组件,它可以帮助我们实现应用程序的安全性,本文将详细介绍Spring Security在Spring Boot框架中的使用,包括如何配置Spring Security、如何实现身份验证和授权、如何防止攻击等2023-06-06
最新评论