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

segmentfault.com | 4 months ago
  1. 0

    spring-boot连接redis错误 - SegmentFault

    segmentfault.com | 4 months ago
    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
  2. 0

    When Using *@EnableCaching(mode = AdviceMode.ASPECTJ)* for Redis Cache, custom error handler is not getting registered, however *AdviceMode.PROXY* is working as expected. Below is Cache Configuration {code:title=CacheConfiguration.java|borderStyle=solid} @Configuration @EnableCaching(mode = AdviceMode.ASPECTJ) public class AutoConfInitializer extends CachingConfigurerSupport { @Bean public RedisConnectionFactory jedisConnectionFactory(){ List<URI> uris = getURIS(); URI uri = uris.get(0); JedisConnectionFactory redisConnectionFactory = new JedisConnectionFactory(); redisConnectionFactory.setHostName(uri.getHost()); redisConnectionFactory.setPort(uri.getPort()); redisConnectionFactory.setPassword(uri.getUserInfo()); redisConnectionFactory.setUsePool(true); return redisConnectionFactory; } @Bean(name="redisTemplate") public RedisTemplate<Object, Object> redisTemplate() { RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>(); redisTemplate.setConnectionFactory(jedisConnectionFactory()); redisTemplate.setKeySerializer(new GenericJackson2JsonRedisSerializer()); return redisTemplate; } @Bean @Override public CacheManager cacheManager() { // configure and return an implementation of Spring's CacheManager SPI RedisCacheManager manager = new RedisCacheManager(redisTemplate()); // manager.setDefaultExpiration(); manager.setCacheNames(Collections.unmodifiableList(new ArrayList<>(getCacheProps().keySet()))); manager.setUsePrefix(Boolean.TRUE); manager.setExpires(getCacheProps()); manager.setCachePrefix(cacheName -> (getCachePrefix()+cacheName).getBytes()); return manager; } @Override @Bean public CacheErrorHandler errorHandler() { return new AutoConfInitializer.DefaultCacheErrorHandler(); } // @Configuration public static class DefaultCacheErrorHandler implements CacheErrorHandler { private static final Logger LOG = LoggerFactory.getLogger(DefaultCacheErrorHandler.class); @Override public void handleCacheGetError(RuntimeException exception, Cache cache, Object key) { LOG.warn("[CACHE-CRITICAL]- Unable to retrieve from cache:{}", cache.getName(),exception); } @Override public void handleCachePutError(RuntimeException exception, Cache cache, Object key, Object value) { LOG.warn("[CACHE-CRITICAL]- Unable to Put in cache:{}", cache.getName(),exception); } @Override public void handleCacheEvictError(RuntimeException exception, Cache cache, Object key) { LOG.warn("[CACHE-CRITICAL]- Unable to Evict from cache:{}", cache.getName(),exception); } @Override public void handleCacheClearError(RuntimeException exception, Cache cache) { LOG.warn("[CACHE-CRITICAL]- Unable to clear cache:{}", cache.getName(),exception); } } {code} With advice mode aspectj getting the below exception (as the error handler is setting to SimpleCacheErrorHandler ): 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 at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:198)

    Spring JIRA | 6 months ago | Jayaram Pradhan
    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
  3. 0

    Redis (AWS Elasticache) stops working after sometime

    Stack Overflow | 3 weeks ago | Gaurav Srivastava
    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
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Is possible connect on CODIS using Jedi?

    GitHub | 11 months ago | thiagohora
    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
  6. 0

    Spring HTTP actuator fails if Redis (via Spring Session) is down

    GitHub | 12 months ago | davidmelia
    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

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. 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

      at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector()
    2. Spring Data Redis
      DefaultValueOperations.set
      1. org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:162)
      2. org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:251)
      3. org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:58)
      4. org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:128)
      5. org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:91)
      6. org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:78)
      7. org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:178)
      8. org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:153)
      9. org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:86)
      10. org.springframework.data.redis.core.DefaultValueOperations.set(DefaultValueOperations.java:169)
      10 frames
    3. com.itapp
      ItAppApiApplicationTests.test
      1. com.itapp.ItAppApiApplicationTests.test(ItAppApiApplicationTests.java:20)
      1 frame
    4. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:483)
      4 frames
    5. JUnit
      InvokeMethod.evaluate
      1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      4. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      4 frames
    6. Spring TestContext
      SpringRepeat.evaluate
      1. org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
      2. org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
      3. org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
      3 frames
    7. JUnit
      ParentRunner.runLeaf
      1. org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      1 frame
    8. Spring TestContext
      SpringJUnit4ClassRunner.runChild
      1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:254)
      2. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)
      2 frames
    9. JUnit
      ParentRunner$2.evaluate
      1. org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      2. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      3. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      4. org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      5. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      5 frames
    10. Spring TestContext
      RunAfterTestClassCallbacks.evaluate
      1. org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
      2. org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
      2 frames
    11. JUnit
      ParentRunner.run
      1. org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      1 frame
    12. Spring TestContext
      SpringJUnit4ClassRunner.run
      1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:193)
      1 frame
    13. JUnit4 Runner
      JUnit4TestReference.run
      1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      1 frame
    14. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      5 frames