Cannot get jedis connection Could not get a resource from the pool 解决办法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/majishushu/article/details/80686322

redis报错

org.springframework.data.redis.RedisConnectionFailureException:Cannot get Jedis connection; nested exception isredis.clients.jedis.exceptions.JedisConnectionException: Could not get aresource from the pool

         atorg.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:204)

         atorg.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:348)

         atorg.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:129)

我确定自己电脑的redis是打开的,防火墙设置也没有问题,密码默认是没有的不用填写。不知道错在了哪里。后来问一个技术高超的同事,才知道redis默认只能本机访问ip默认地址是127.0.0.1而我填写的是IPv4地址,所以redis无法识别导致报错。将配置改成下图之后,运行成功了。



JedisConnectionException: Could not get a resource from the pool

12-02

前辈们,您们好:rn 硬件:win7 64bit webloginc 10.3 (32bit)/java 1.6(安装weblogic使用的自带Java版本)rn 我使用weblogic部署wap环境后登录(在进入debug之前就会异常),就会出现“不能从连接池获取资源”异常,具体如下:rnat redis.clients.util.Pool.getResource(Pool.java:22)rn at com.ai.log.util.redis.RedisManager.getJedis(RedisManager.java:64)rn at com.ai.log.client.RedisLogAppend.getJedis(RedisLogAppend.java:87)rn at com.ai.log.client.RedisLogAppend.append(RedisLogAppend.java:48)rn at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221)rn at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:57)rn at org.apache.log4j.Category.callAppenders(Category.java:187)rn at org.apache.log4j.Category.forcedLog(Category.java:372)rn at org.apache.log4j.Category.error(Category.java:286)rn……(此处省略更多行)rnCaused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketTimeoutException: connect timed outrn at redis.clients.jedis.Connection.connect(Connection.java:134)rn at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:69)rn at redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1665)rn at redis.clients.jedis.JedisPool$JedisFactory.makeObject(JedisPool.java:72)rn at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:840)rn at redis.clients.util.Pool.getResource(Pool.java:20)rn ... 79 morernCaused by: java.net.SocketTimeoutException: connect timed outrn at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)rn at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)rn at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)rn at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)rn at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)rn at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)rn at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)rn at java.net.Socket.connect(Socket.java:579)rn at redis.clients.jedis.Connection.connect(Connection.java:129)rn ... 84 morern我使用过的方法:1、更改redis.properties配置(非-1、大数字也试过)rnMaxActive=-1rnMaxIdle=-1rnMaxWait=10000rn2、试过安装官网通用版weblogic 10.X;rn3、考虑更换Tomcat部署,但是配置文件太多(15个),不知道如何部署。rn4、修改过weblogic里一个什么=64 的;//适用于64位系统rn5、防火墙已关闭,Jedis不知如何判断是否启动;rn6、中国移动wap的jedis版本不可能低于2.4.2吧;rnrn 发梢挠到后脑勺,异常坚强如磐石。愁~ 瞅 ~ 愁~rn

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试