欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

記一次springboot配置redis項(xiàng)目啟動(dòng)時(shí)的一個(gè)奇怪的錯(cuò)誤

 更新時(shí)間:2022年02月22日 15:40:56   作者:vXZH  
這篇文章主要介紹了spring?boot配置redis項(xiàng)目啟動(dòng)時(shí)的一個(gè)奇怪的錯(cuò)誤,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

springboot配置redis項(xiàng)目啟動(dòng)時(shí)的錯(cuò)誤

在剛開(kāi)始學(xué)redis時(shí),我照著網(wǎng)上的教程,把redis和jedis整合到spring boot,整合完畢后,啟動(dòng)項(xiàng)目總是失敗

總是爆出下面的錯(cuò)誤

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

然后我在網(wǎng)上找了很久,都沒(méi)有關(guān)于這個(gè)錯(cuò)誤的解決辦法,偶然看到一篇博客,它在啟動(dòng)項(xiàng)目時(shí)也出現(xiàn)了類(lèi)型錯(cuò)誤,也是jar包沖突,然后那個(gè)博主是通過(guò)改redis和jedis的版本號(hào)解決的,我也把版本號(hào)都改成和那個(gè)博主相同的,但啟動(dòng)后還是出現(xiàn)相同的錯(cuò)誤。

后來(lái)就想如果我把版本號(hào)都去掉,讓“spring-boot-starter-parent”自動(dòng)為我們提供對(duì)應(yīng)版本的jar包,這樣就可以避免自己指定版本號(hào)時(shí),可能會(huì)有一些意想不到的沖突。于是我就把redis和jedis的版本號(hào)都去掉,果然項(xiàng)目就可以正常啟動(dòng)了~~

What a strange error..

解決springboot項(xiàng)目啟動(dòng)時(shí)redis報(bào)錯(cuò)

出現(xiàn)ERR Client sent AUTH, but no password is set的問(wèn)題

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

顯然上面配置了redis的啟動(dòng)密碼為123456,

本地redis版本為3.0.1 在redis.windows.conf文件中requirepass內(nèi)容也修改了密碼為123456,這里說(shuō)下,在去除requirepass前面的#號(hào)時(shí)一定注意還有一個(gè)空格要去除,不然會(huì)報(bào)錯(cuò):

Invalid argument during startup: unknown conf file parameter :  requirepass

這時(shí),說(shuō)明redis密碼與springboot的一致,接下來(lái)就是啟動(dòng)redis再啟動(dòng)springboot。

我員來(lái)的啟動(dòng)方式就是進(jìn)入到redis的安裝目錄,執(zhí)行redis-server.exe,然后正常啟動(dòng)。但是在啟動(dòng)springboot后,調(diào)用redis時(shí)就報(bào)錯(cuò)了,如圖:

一開(kāi)始以為是我Pom.xml文件中引入的為2.9.0的redis依賴導(dǎo)致的版本不兼容,一直去找Redis的2.9.0的安裝包竟然網(wǎng)上沒(méi)有。浪費(fèi)了半天時(shí)間。

后來(lái)才發(fā)現(xiàn),這個(gè)報(bào)錯(cuò)是告訴我沒(méi)有設(shè)置密碼。原因就是啟動(dòng)時(shí)的方法錯(cuò)誤。

請(qǐng)務(wù)必記住,啟動(dòng)本地redis,如果設(shè)置了密碼記得帶上配置文件,啟動(dòng)命令完整為:

redis-server.exe redis.windows.conf

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論