温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Springboot2.6集成redis maven报错怎么解决

发布时间:2023-04-15 14:10:52 来源:亿速云 阅读:171 作者:iii 栏目:开发技术

本文小编为大家详细介绍“Springboot2.6集成redis maven报错怎么解决”,内容详细,步骤清晰,细节处理妥当,希望这篇“Springboot2.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

    执行这个批处理,

    Springboot2.6集成redis maven报错怎么解决

    删完后,按下面图,update一把就好了

    Springboot2.6集成redis maven报错怎么解决

    SpringBoot集成Redis连接不上

    问题描述

    初学SpringBoot

    当进行SpringBoot集成Redis时。测试向redis中添加String类型的数据,key=name , value = zlw

    但出现了一下错误:(Whitelabel Error Page)

    Springboot2.6集成redis maven报错怎么解决

    看控制台输出发现,大致应该是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的防火墙才行。。。

    试一试

    Springboot2.6集成redis maven报错怎么解决

    可以看到防火墙已经关闭了,

    哇~有新发现了,虽然页面还是没有变化,但控制台的信息发生了变化。

    提示:

    WRONGPASS invalid username-password pair or user is disabled.

    这应该是我的redis密码有问题。。

    原来是我的密码加上了引号

    记住:密码要去掉引号!!!

    去掉双引号之后再次访问,成功!!

    Springboot2.6集成redis maven报错怎么解决

    Springboot2.6集成redis maven报错怎么解决

    读到这里,这篇“Springboot2.6集成redis maven报错怎么解决”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注亿速云行业资讯频道。

    向AI问一下细节

    免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

    AI