HTTP Status 500 - Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.Je

时间:2022-12-26 17:29:36
HTTP Status 500 - Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: 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

产生此错误的原因通常是Redis没有启动,或者是由于防火墙等原因无法连接到Redis;