org.springframework.data.redis.RedisConnectionFailureException和java.net.SocketTimeoutException

此博客是windows中redis报错信息,解决方案

前端报错:

在这里插入图片描述

error:"Internal Server Error"
exception:"org.springframework.data.redis.RedisConnectionFailureException"
message:"Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool"
path:"/agency/manage/addAgent"
status:500
timestamp:1546850412424

关键信息是:redis的连接失败,后台出的问题,

后台报错信息

在这里插入图片描述

2019-01-07 16:40:12.415 [http-nio-18030-exec-10] ERROR o.a.c.c.C.[.[localhost].[/].[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
java.net.SocketTimeoutException: connect timed out
	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
	at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)

后台报错信息给我们的提示是redis配置有问题:

解决方法:

1.第一步:改项目中的redis配置参数,路径,密码
在这里插入图片描述
2.修改本地redis的配置文件设置密码:
在这里插入图片描述
重启redis就可以了,其实不然系统后台还是报错了:

redis.clients.jedis.exceptions.JedisDataException: NOAUTH Authentication required.
    at redis.clients.jedis.Protocol.processError(Protocol.java:117)
    at redis.clients.jedis.Protocol.process(Protocol.java:142)
    at redis.clients.jedis.Protocol.read(Protocol.java:196)
    at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:288)
    at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:187)
    at redis.clients.jedis.BinaryJedis.ping(BinaryJedis.java:109)
    at com.firstelite.test.Test4Jedis.testTwo(Test4Jedis.java:15)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

问题出在我只配置了一个redis文件导致还是无法正常使用redis,此时就要去改两个配置文件并且保持修改的密码一致性
在这里插入图片描述
然后重启redis就可以了。如何重启的方法:
键入win+R打开运行对话框,键入services.msc打开windows服务窗口,找到redis服务,先停止该服务,然后再启动,有多种方法,但我喜欢这种简单那粗暴,这样就OK了!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值