org.springframework.data.redis.RedisConnectionFailureException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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)
    via by Jayaram Pradhan,
  • spring-boot连接redis错误 - SegmentFault
    via by Unknown author,
    • 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)

    Users with the same issue

    Kawada
    11 times, last one,