龙空技术网

redis链接Could not get a resource from the pool你遇到了吗?

好看剧巨好看 171

前言:

眼前你们对“eclipse没有java resources”大致比较着重,同学们都想要知道一些“eclipse没有java resources”的相关内容。那么小编同时在网摘上收集了一些有关“eclipse没有java resources””的相关文章,希望姐妹们能喜欢,看官们一起来学习一下吧!

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)	at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:345)	at org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:128)	at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:91)	at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:78)	at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:189)	at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:164)	at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:88)	at org.springframework.data.redis.core.DefaultValueOperations.set(DefaultValueOperations.java:169)	at com.tjzs.sccms.testuser.TestProduct.testRedis(TestProduct.java:68)	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)	at java.lang.reflect.Method.invoke(Unknown Source)	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)	at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)	at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)	at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)Caused by: redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool	at redis.clients.util.Pool.getResource(Pool.java:53)	at redis.clients.jedis.JedisPool.getResource(JedisPool.java:99)	at redis.clients.jedis.JedisPool.getResource(JedisPool.java:11)	at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:191)	... 38 moreCaused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.UnknownHostException: 127.0.0.1 	at redis.clients.jedis.Connection.connect(Connection.java:148)	at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:75)	at redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1790)	at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:71)	at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:819)	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:429)	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:360)	at redis.clients.util.Pool.getResource(Pool.java:51)	... 41 moreCaused by: java.net.UnknownHostException: 127.0.0.1 	at java.net.AbstractPlainSocketImpl.connect(Unknown Source)	at java.net.PlainSocketImpl.connect(Unknown Source)	at java.net.SocksSocketImpl.connect(Unknown Source)	at java.net.Socket.connect(Unknown Source)	at redis.clients.jedis.Connection.connect(Connection.java:142)	... 48 more

Could not get a resource from the pool

使用redis之后遇到的最头疼的一个问题

本来程序跑得好好的,换到台式机上做测试

然后redis就开始报这个问题了

然后?网上各种搜索,真的

答案很多,大部分都是copy可能

答案基本差不多,说是MaxActive连接数云云

好吧,改了,然并卵

有说jedis中,没有释放链接造成的,看了一下

好吧,可是在实际开发中,难道用spring-data-redis会这么麻烦吗?

作为新人,有些不能理解,如果是这样恐怕也有点spring的初衷了吧!!!

然后,今天继续找

好吧,向下看报错信息

以前真的没注意到,太粗心了

Could not get a resource from the pool

在这个报错信息之后,其实后面还有一个更加主要的

Caused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.UnknownHostException: 127.0.0.1

然后,卧槽,基本确定,配置文件中的问题

然后直接定位到这里,我去,尼玛properties文件中

127.0.0.1后面有两个空格!!!尼玛呵呵了

至此问题终于解决

真的,其实网上很多都是大神

但也从不缺少copy党.....

标签: #eclipse没有java resources