当需要获取redis连接的时候,就报如下异常:
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:162)
at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:251)
可能的原因有很多,最主要就是连不到redis;
我遇到这个问题也百度了N次,还是没有解决,最后去检查了配置文件,发现配置文件后面有空格,有空格;
这是读取pom.xm数据的,因为空格,导致不能读取到数据,删掉空格后完美解决。