用Redis的時候出現(xiàn)的問題

問題一:

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method redisTemplate in org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration required a bean of type 'org.springframework.data.redis.connection.RedisConnectionFactory' that could not be found.

The injection point has the following annotations:
    - @org.springframework.beans.factory.annotation.Autowired(required=true)

The following candidates were found but could not be injected:
    - Bean method 'redisConnectionFactory' in 'JedisConnectionConfiguration' not loaded because @ConditionalOnClass did not find required classes 'org.apache.commons.pool2.impl.GenericObjectPool', 'redis.clients.jedis.Jedis'
    - Bean method 'redisConnectionFactory' in 'LettuceConnectionConfiguration' not loaded because @ConditionalOnClass did not find required class 'io.lettuce.core.RedisClient'

具體見圖:


image.png

這個是在使用redis的時候依賴添加錯誤了

錯誤的依賴

<dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-redis</artifactId>
            <version>2.1.3.RELEASE</version>
        </dependency>

正確的依賴

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-redis</artifactId>
            <version>1.4.0.RELEASE</version>
        </dependency>

問題二:

2020-02-06 18:45:36.823 ERROR 10940 --- [nio-8012-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.data.redis.serializer.SerializationException: Cannot serialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.lang.IllegalArgumentException: DefaultSerializer requires a Serializable payload but received an object of type [com.redisdemo.demo.entity.User]] with root cause

java.lang.IllegalArgumentException: DefaultSerializer requires a Serializable payload but received an object of type [com.redisdemo.demo.entity.User]
image.png

工具類SerializeUtil序列化時無法識別User對象,修改User類實現(xiàn)Serializable接口(public class User implements Serializable)垦江,問題解決没佑。如下圖:


image.png

問題三:

2020-02-06 20:54:38.762 ERROR 11828 --- [nio-8012-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool] with root cause

redis.clients.jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set
image.png

問題看起來很清楚滨攻,這句:ERR Client sent AUTH, but no password is set锹漱,它的意思就是redis服務器沒設置密碼董饰,這里還設置了password屈嗤,而且即使是空“”也不行岳锁。把整個password去掉绩衷,重啟就可以啦

image.png
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市激率,隨后出現(xiàn)的幾起案子唇聘,更是在濱河造成了極大的恐慌,老刑警劉巖柱搜,帶你破解...
    沈念sama閱讀 217,185評論 6 503
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件迟郎,死亡現(xiàn)場離奇詭異,居然都是意外死亡聪蘸,警方通過查閱死者的電腦和手機宪肖,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,652評論 3 393
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來健爬,“玉大人控乾,你說我怎么就攤上這事∧茸瘢” “怎么了蜕衡?”我有些...
    開封第一講書人閱讀 163,524評論 0 353
  • 文/不壞的土叔 我叫張陵,是天一觀的道長设拟。 經(jīng)常有香客問我慨仿,道長,這世上最難降的妖魔是什么纳胧? 我笑而不...
    開封第一講書人閱讀 58,339評論 1 293
  • 正文 為了忘掉前任镰吆,我火速辦了婚禮,結果婚禮上跑慕,老公的妹妹穿的比我還像新娘万皿。我一直安慰自己,他們只是感情好核行,可當我...
    茶點故事閱讀 67,387評論 6 391
  • 文/花漫 我一把揭開白布牢硅。 她就那樣靜靜地躺著,像睡著了一般芝雪。 火紅的嫁衣襯著肌膚如雪减余。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,287評論 1 301
  • 那天绵脯,我揣著相機與錄音佳励,去河邊找鬼休里。 笑死,一個胖子當著我的面吹牛赃承,可吹牛的內容都是我干的妙黍。 我是一名探鬼主播,決...
    沈念sama閱讀 40,130評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼瞧剖,長吁一口氣:“原來是場噩夢啊……” “哼拭嫁!你這毒婦竟也來了?” 一聲冷哼從身側響起抓于,我...
    開封第一講書人閱讀 38,985評論 0 275
  • 序言:老撾萬榮一對情侶失蹤做粤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后捉撮,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體怕品,經(jīng)...
    沈念sama閱讀 45,420評論 1 313
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 37,617評論 3 334
  • 正文 我和宋清朗相戀三年巾遭,在試婚紗的時候發(fā)現(xiàn)自己被綠了肉康。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,779評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡灼舍,死狀恐怖吼和,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情骑素,我是刑警寧澤炫乓,帶...
    沈念sama閱讀 35,477評論 5 345
  • 正文 年R本政府宣布,位于F島的核電站献丑,受9級特大地震影響末捣,放射性物質發(fā)生泄漏。R本人自食惡果不足惜阳距,卻給世界環(huán)境...
    茶點故事閱讀 41,088評論 3 328
  • 文/蒙蒙 一塔粒、第九天 我趴在偏房一處隱蔽的房頂上張望结借。 院中可真熱鬧筐摘,春花似錦、人聲如沸船老。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,716評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽柳畔。三九已至馍管,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間薪韩,已是汗流浹背确沸。 一陣腳步聲響...
    開封第一講書人閱讀 32,857評論 1 269
  • 我被黑心中介騙來泰國打工捌锭, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人罗捎。 一個月前我還...
    沈念sama閱讀 47,876評論 2 370
  • 正文 我出身青樓观谦,卻偏偏與公主長得像,于是被迫代替她去往敵國和親桨菜。 傳聞我的和親對象是個殘疾皇子豁状,可洞房花燭夜當晚...
    茶點故事閱讀 44,700評論 2 354

推薦閱讀更多精彩內容

  • 1 Redis介紹1.1 什么是NoSql為了解決高并發(fā)泻红、高可擴展、高可用霞掺、大數(shù)據(jù)存儲問題而產(chǎn)生的數(shù)據(jù)庫解決方...
    克魯?shù)吕?/span>閱讀 5,291評論 0 36
  • NOSQL類型簡介鍵值對:會使用到一個哈希表谊路,表中有一個特定的鍵和一個指針指向特定的數(shù)據(jù),如redis菩彬,volde...
    MicoCube閱讀 3,981評論 2 27
  • RedisRedis命令參考網(wǎng)址:http://doc.redisfans.com/ Redis 簡介Redis ...
    野柳閱讀 1,125評論 0 9
  • 2018.7.21星期六天氣晴 親子日記第137天 《父母規(guī)》第111天 姐姐今天參加了青春志愿行——溫暖火...
    愛騰睿閱讀 325評論 3 7
  • 致女神 我這個裝滿你的頭因你回凶异, 我這個不由己的身隨你轉, 我這顆不安分的心為你動挤巡; 你不經(jīng)意間看我的那一眼剩彬, 其...
    補缺樓丨胡德棒閱讀 266評論 0 2