iis服务器助手广告广告
返回顶部
首页 > 资讯 > 精选 >springboot配置redis项目启动时错误怎么解决
  • 570
分享到

springboot配置redis项目启动时错误怎么解决

2023-06-29 06:06:16 570人浏览 八月长安
摘要

这篇“SpringBoot配置redis项目启动时错误怎么解决”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“springbo

这篇“SpringBoot配置redis项目启动时错误怎么解决”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“springboot配置Redis项目启动时错误怎么解决”文章吧。

springboot配置redis项目启动时的错误

在刚开始学redis时,我照着网上的教程,把redis和jedis整合到Spring Boot,整合完毕后,启动项目总是失败

总是爆出下面的错误

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.data.repository.config.RepositoryConfigurationSource

***************************
APPLICATION FAILED TO START
***************************
 
Description:
 
An attempt was made to call the method org.springframework.data.repository.config.RepositoryConfigurationSource.getAttribute(Ljava/lang/String;)Ljava/lang/String; but it does not exist. Its class, org.springframework.data.repository.config.RepositoryConfigurationSource, is available from the following locations:
 
jar:file:/D:/m2/repository/org/springframework/data/spring-data-commons/2.0.10.RELEASE/spring-data-commons-2.0.10.RELEASE.jar!/org/springframework/data/repository/config/RepositoryConfigurationSource.class
 
It was loaded from the following location:
 
file:/D:/m2/repository/org/springframework/data/spring-data-commons/2.0.10.RELEASE/spring-data-commons-2.0.10.RELEASE.jar
 
Action:
 
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.data.repository.config.RepositoryConfigurationSource
 
2018-11-22 13:03:51.398 INFO 2196 --- [ main] ConfigServletWEBServerApplicationContext : Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@1a451d4d: startup date [Thu Nov 22 13:03:50 CST 2018]; root of context hierarchy
 
Process finished with exit code 1

然后我在网上找了很久,都没有关于这个错误的解决办法,偶然看到一篇博客,它在启动项目时也出现了类型错误,也是jar包冲突,然后那个博主是通过改redis和jedis的版本号解决的,我也把版本号都改成和那个博主相同的,但启动后还是出现相同的错误。

后来就想如果我把版本号都去掉,让“spring-boot-starter-parent”自动为我们提供对应版本的jar包,这样就可以避免自己指定版本号时,可能会有一些意想不到的冲突。于是我就把redis和jedis的版本号都去掉,果然项目就可以正常启动了~~

What a strange error..

springboot配置redis项目启动时错误怎么解决

解决springboot项目启动时redis报错

出现ERR Client sent AUTH, but no passWord is set的问题

首先看下我springboot配置redis的部分如图:

springboot配置redis项目启动时错误怎么解决

显然上面配置了redis的启动密码为123456,

本地redis版本为3.0.1 在redis.windows.conf文件中requirepass内容也修改了密码为123456,这里说下,在去除requirepass前面的#号时一定注意还有一个空格要去除,不然会报错:

Invalid argument during startup: unknown conf file parameter :  requirepass

这时,说明redis密码与springboot的一致,接下来就是启动redis再启动springboot。

我员来的启动方式就是进入到redis的安装目录,执行redis-server.exe,然后正常启动。但是在启动springboot后,调用redis时就报错了,如图:

springboot配置redis项目启动时错误怎么解决

一开始以为是我Pom.xml文件中引入的为2.9.0的redis依赖导致的版本不兼容,一直去找Redis的2.9.0的安装包竟然网上没有。浪费了半天时间。

后来才发现,这个报错是告诉我没有设置密码。原因就是启动时的方法错误。

请务必记住,启动本地redis,如果设置了密码记得带上配置文件,启动命令完整为:

redis-server.exe redis.windows.conf

以上就是关于“springboot配置redis项目启动时错误怎么解决”这篇文章的内容,相信大家都有了一定的了解,希望小编分享的内容对大家有帮助,若想了解更多相关的知识内容,请关注编程网精选频道。

--结束END--

本文标题: springboot配置redis项目启动时错误怎么解决

本文链接: https://www.lsjlt.com/news/323196.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作