关于 jesdis Could not get a resource from the pool

关于这个被坑了很久的问题

type Exception report

message Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool

description The server encountered an internal error that prevented it from fulfilling this request.

exception

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
	org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:97)
	org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:143)
	org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:41)
	org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:128)
	org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:91)
	org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:78)
	org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:177)
	org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:152)
	org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:84)
	org.springframework.data.redis.core.DefaultValueOperations.get(DefaultValueOperations.java:43)
	org.springframework.data.redis.core.DefaultBoundValueOperations.get(DefaultBoundValueOperations.java:41)
	com.auth.provider.impl.DefaultRememberMeProvider.findRememberMeById(DefaultRememberMeProvider.java:47)
	com.auth.AbstractSessionManager.getRememberMe(AbstractSessionManager.java:254)
	com.auth.filter.AuthenticationFilter.doFilterInternal(AuthenticationFilter.java:84)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
	org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
	org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
root cause

redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
	redis.clients.util.Pool.getResource(Pool.java:42)
	org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:90)
	org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:143)
	org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:41)
	org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:128)
	org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:91)
	org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:78)
	org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:177)
	org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:152)
	org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:84)
	org.springframework.data.redis.core.DefaultValueOperations.get(DefaultValueOperations.java:43)
	org.springframework.data.redis.core.DefaultBoundValueOperations.get(DefaultBoundValueOperations.java:41)
	com.auth.provider.impl.DefaultRememberMeProvider.findRememberMeById(DefaultRememberMeProvider.java:47)
	com.auth.AbstractSessionManager.getRememberMe(AbstractSessionManager.java:254)
	com.auth.filter.AuthenticationFilter.doFilterInternal(AuthenticationFilter.java:84)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
	org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
	org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
root cause

redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused: connect
	redis.clients.jedis.Connection.connect(Connection.java:142)
	redis.clients.jedis.BinaryClient.connect(BinaryClient.java:75)
	redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1724)
	redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:65)
	org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:836)
	org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:434)
	org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:361)
	redis.clients.util.Pool.getResource(Pool.java:40)
	org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:90)
	org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:143)
	org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:41)
	org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:128)
	org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:91)
	org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:78)
	org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:177)
	org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:152)
	org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:84)
	org.springframework.data.redis.core.DefaultValueOperations.get(DefaultValueOperations.java:43)
	org.springframework.data.redis.core.DefaultBoundValueOperations.get(DefaultBoundValueOperations.java:41)
	com.auth.provider.impl.DefaultRememberMeProvider.findRememberMeById(DefaultRememberMeProvider.java:47)
	com.auth.AbstractSessionManager.getRememberMe(AbstractSessionManager.java:254)
	com.auth.filter.AuthenticationFilter.doFilterInternal(AuthenticationFilter.java:84)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
	org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
	org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
root cause

java.net.ConnectException: Connection refused: connect
	java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
	java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
	java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
	java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
	java.net.AbstractPlainSocketImpl.connect(Unknown Source)
	java.net.PlainSocketImpl.connect(Unknown Source)
	java.net.SocksSocketImpl.connect(Unknown Source)
	java.net.Socket.connect(Unknown Source)
	redis.clients.jedis.Connection.connect(Connection.java:137)
	redis.clients.jedis.BinaryClient.connect(BinaryClient.java:75)
	redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1724)
	redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:65)
	org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:836)
	org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:434)
	org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:361)
	redis.clients.util.Pool.getResource(Pool.java:40)
	org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:90)
	org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:143)
	org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:41)
	org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:128)
	org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:91)
	org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:78)
	org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:177)
	org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:152)
	org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:84)
	org.springframework.data.redis.core.DefaultValueOperations.get(DefaultValueOperations.java:43)
	org.springframework.data.redis.core.DefaultBoundValueOperations.get(DefaultBoundValueOperations.java:41)
	com.auth.provider.impl.DefaultRememberMeProvider.findRememberMeById(DefaultRememberMeProvider.java:47)
	com.auth.AbstractSessionManager.getRememberMe(AbstractSessionManager.java:254)
	com.auth.filter.AuthenticationFilter.doFilterInternal(AuthenticationFilter.java:84)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
	org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
	org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.54 logs.

Apache Tomcat/7.0.54

进过多次检查,首先确定
1.redis连接成功
2.jedis资源在finally中释放
3.max-ative
4!!!!!服务器的防火墙关闭!!!
被这个坑了好久,关闭防火墙命令
service firewalld stop

具体请看博客
https://blog.csdn.net/testcs_dn/article/details/43052585

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值