国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

【Springboot整合Redis已解決】 Unable to connect to Redis; nested exception is org.springframework.data.redi

這篇具有很好參考價值的文章主要介紹了【Springboot整合Redis已解決】 Unable to connect to Redis; nested exception is org.springframework.data.redi。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報違法"按鈕提交疑問。

介紹

這里是小編成長之路的歷程,也是小編的學(xué)習(xí)之路。希望和各位大佬們一起成長!

以下為小編最喜歡的兩句話:

要有最樸素的生活和最遙遠(yuǎn)的夢想,即使明天天寒地凍,山高水遠(yuǎn),路遠(yuǎn)馬亡。

一個人為什么要努力? 我見過最好的答案就是:因?yàn)槲蚁矚g的東西都很貴,我想去的地方都很遠(yuǎn),我愛的人超完美。因此,小編想說:共勉!

小編今天使用Springboot+redis,將數(shù)據(jù)添加到redis中發(fā)生錯誤

問題描述:

以下是報錯的代碼,表示在連接redis的時候報錯,找不到redis的配置文件

org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379
	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.translateException(LettuceConnectionFactory.java:1689)
	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1597)
	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:1383)
	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getConnection(LettuceConnectionFactory.java:1366)
	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getSharedConnection(LettuceConnectionFactory.java:1093)
	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getConnection(LettuceConnectionFactory.java:421)
	at org.springframework.data.redis.core.RedisConnectionUtils.fetchConnection(RedisConnectionUtils.java:193)
	at org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:144)
	at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:105)
	at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:211)
	at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:191)
	at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:97)
	at org.springframework.data.redis.core.DefaultHashOperations.put(DefaultHashOperations.java:253)
	at com.lyn.utlis.RedisUtil.hset(RedisUtil.java:235)
	at com.lyn.controller.CartTwoController.addToCart(CartTwoController.java:30)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1072)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:965)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:555)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:623)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:389)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:926)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1791)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379
	at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.getConnection(LettucePoolingConnectionProvider.java:109)
	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1595)
	... 63 more
Caused by: io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379
	at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:78)
	at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:56)
	at io.lettuce.core.AbstractRedisClient.getConnection(AbstractRedisClient.java:330)
	at io.lettuce.core.RedisClient.connect(RedisClient.java:216)
	at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.lambda$getConnection$1(StandaloneConnectionProvider.java:115)
	at java.util.Optional.orElseGet(Optional.java:267)
	at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.getConnection(StandaloneConnectionProvider.java:115)
	at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.lambda$null$0(LettucePoolingConnectionProvider.java:97)
	at io.lettuce.core.support.ConnectionPoolSupport$RedisPooledObjectFactory.create(ConnectionPoolSupport.java:211)
	at io.lettuce.core.support.ConnectionPoolSupport$RedisPooledObjectFactory.create(ConnectionPoolSupport.java:201)
	at org.apache.commons.pool2.BasePooledObjectFactory.makeObject(BasePooledObjectFactory.java:70)
	at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:571)
	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:298)
	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:223)
	at io.lettuce.core.support.ConnectionPoolSupport$1.borrowObject(ConnectionPoolSupport.java:122)
	at io.lettuce.core.support.ConnectionPoolSupport$1.borrowObject(ConnectionPoolSupport.java:117)
	at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.getConnection(LettucePoolingConnectionProvider.java:103)
	... 64 more
Caused by: io.lettuce.core.RedisCommandExecutionException: NOAUTH Authentication required.
	at io.lettuce.core.internal.ExceptionFactory.createExecutionException(ExceptionFactory.java:147)
	at io.lettuce.core.internal.ExceptionFactory.createExecutionException(ExceptionFactory.java:116)
	at io.lettuce.core.protocol.AsyncCommand.completeResult(AsyncCommand.java:120)
	at io.lettuce.core.protocol.AsyncCommand.complete(AsyncCommand.java:111)
	at io.lettuce.core.protocol.CommandHandler.complete(CommandHandler.java:747)
	at io.lettuce.core.protocol.CommandHandler.decode(CommandHandler.java:682)
	at io.lettuce.core.protocol.CommandHandler.channelRead(CommandHandler.java:599)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	... 1 more

解決方法:

下面的代碼是application.properties的配置 ,小編就犯了一個錯誤,在spring配置文件中加入redis的時候沒有在前面加入spring

# 這個是整合swagger文檔的時候,啟動出現(xiàn)報錯的解決,主要原因是springboot parent版本過高,與swagger不兼容
spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER


redis.host=localhost
redis.port=6379
redis.password=123456
redis.maxIdle=50
redis.maxTotal=100
redis.maxWaitMillis=3000
redis.testOnBorrow=true
redis.timeout=5000
redis.nowDatabase=0

這個時候就更改一下application.properties配置文件

# 這個是整合swagger文檔的時候,啟動出現(xiàn)報錯的解決,主要原因是springboot parent版本過高,與swagger不兼容
spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER

spring.redis.host=localhost
spring.redis.port=6379
spring.redis.password=123456
spring.redis.maxIdle=50
spring.redis.maxTotal=100
spring.redis.maxWaitMillis=3000
spring.redis.testOnBorrow=true
spring.redis.timeout=5000
spring.redis.nowDatabase=0

以上就是小編所實(shí)踐的內(nèi)容,希望能夠幫助到大家,感謝各位大佬的觀看?。。?span toymoban-style="hidden">文章來源地址http://www.zghlxwxcb.cn/news/detail-608257.html

到了這里,關(guān)于【Springboot整合Redis已解決】 Unable to connect to Redis; nested exception is org.springframework.data.redi的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • Unable to start web server; nested exception is org.springframework.context.ApplicationContextExcept

    Unable to start web server; nested exception is org.springframework.context.ApplicationContextExcept

    SpringBoot項(xiàng)目啟動報錯,如圖 Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.這個錯誤 可以看出ServletWebServerFactory在sping容器啟動時沒有將其注冊進(jìn)去,缺少相關(guān)依賴。沒有

    2024年02月14日
    瀏覽(20)
  • Spring boot連接Redis服務(wù)器報Unable to connect to Redis問題分析與解決

    Spring boot連接Redis服務(wù)器報Unable to connect to Redis問題分析與解決

    1.Unable to connect to Redis:翻譯:無法連接到Redis 很明顯是Redis服務(wù)未被連接 比如我這個,是因?yàn)榇蜻B接不上本地端口:6379。 呢么就有兩種可能: 1.查看Spring boot的yml文件,看是否連接的是6379端口 如下: 沒問題是 本地的6379,呢么就只有一種情況是因?yàn)楸镜氐姆?wù)沒打開。 打

    2024年02月14日
    瀏覽(93)
  • Failed to obtain JDBC Connection; nested exception is java.sql.SQLException

    Failed to obtain JDBC Connection; nested exception is java.sql.SQLException

    Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: The server time zone value \\\'?й???????\\\' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the \\\'serverTimezone\\\' configuration property) to use a more specifc time zone value if you want to utilize time zone s

    2024年02月11日
    瀏覽(24)
  • Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerExcepti

    Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerExcepti

    Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat 這是我自己項(xiàng)目加錯了報錯了。? ?

    2024年02月16日
    瀏覽(15)
  • Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.excepti

    Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.excepti

    ? ? 這是第一個錯,解決了還有其他的 這個錯誤的原因在我配置applicationContext.xml中,沒有給數(shù)據(jù)庫配置時區(qū),但是我之前的代碼都正常運(yùn)行,直到使用jdbcTemplate.execute方法才出現(xiàn)這個錯誤。在url后面添加上?useSSL=falseserverTimezone=UTC即可 ? ? ? ? 添加完報錯少了十幾行,出現(xiàn)了

    2024年02月16日
    瀏覽(25)
  • 搭建nacos集群啟動時,報錯Unable to start web server; nested exception is org.springframework.boot.web.server

    搭建nacos集群啟動時,報錯Unable to start web server; nested exception is org.springframework.boot.web.server

    最近在學(xué)習(xí)springcloud阿里巴巴的使用,單機(jī)使用nacos啟動時沒有問題,修改了配置之后啟動報錯,如下 貼出已經(jīng)修改的配置文件,cluster.conf和application.properties cluster.conf如下 application.properties如下,其他不需要修改的地方?jīng)]有復(fù)制進(jìn)來 因?yàn)槭强粗曨l一步一步改的,然后視頻里

    2024年02月14日
    瀏覽(93)
  • Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: com.mysql.jdbc.Driver

    Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: com.mysql.jdbc.Driver

    記錄idea報錯, 1.引用外部庫 mysql-connector-java-8.0.26 dependency ? ? ? groupIdmysql/groupId ? ? ??artifactIdmysql-connector-java/artifactId ? ? ? version8.0.26/version /dependency ? 2. 引入最新版的c3p0 dependency ? ? groupIdcom.mchange/groupId ? ? artifactIdc3p0/artifactId ? ? version0.9.5.5/version /dependency 3.連接的驅(qū)

    2024年02月02日
    瀏覽(20)
  • 數(shù)據(jù)庫報錯 Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied

    數(shù)據(jù)庫報錯 Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied

    如果你也是用Java連接數(shù)據(jù)庫的可以嘗試看看 第一種類型 如果是MySQL8.0以上的,需要在后面加上 如果是這種的錯誤類型的,可以試試 第二種類型 數(shù)據(jù)庫沒有設(shè)置開放權(quán)限,不給連接,這種情況就算是使用連接數(shù)據(jù)庫工具也沒辦法連接的。解決方式如下 第三種類型 這種如果是

    2024年01月24日
    瀏覽(96)
  • Failed to obtain JDBC Connection;nested exception is dm.jdbc.driver.DMException:初始化SSL環(huán)境失敗

    一個基于若依單體架構(gòu)的多模塊 Maven 項(xiàng)目的國產(chǎn)化遷移適配,由于是客戶的代碼,我們不用關(guān)心具體的功能實(shí)現(xiàn),直接來做遷移即可。實(shí)施時,按照我們總結(jié)的整改建議調(diào)整源碼,具體遷移適配過程可參考本專欄的其他文章。 組件 操作系統(tǒng):麒麟V10 CPU: HUAWEI, Kunpeng 920 數(shù)據(jù)

    2023年04月25日
    瀏覽(21)
  • Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: The server time zone va

    這個錯誤表明在嘗試獲取 JDBC 連接時發(fā)生了 SQLException,并且該異常表示服務(wù)器不識別或不包含一個以上的時區(qū)。以下是一些可能的解決方法: 確認(rèn)服務(wù)器時區(qū)設(shè)置:確保你的服務(wù)器時區(qū)設(shè)置正確。你可以在數(shù)據(jù)庫中運(yùn)行以下查詢來檢查當(dāng)前時區(qū)設(shè)置: sql SELECT @@全球化設(shè)置

    2024年02月09日
    瀏覽(19)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包