我是靠谱客的博主 狂野导师,最近开发中收集的这篇文章主要介绍[Exception] redis.clients.jedis.exceptions.JedisConnectionException,觉得挺不错的,现在分享给大家,希望可以做个参考。
概述
情形1:对应的服务器没有开启 (redis server 没有启动)
启动命令:mac: redis-server
redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
at redis.clients.util.Pool.getResource(Pool.java:40)
at com.hadoit.game.common.framework.nosql.redis.JedisDataSource.getResource(JedisDataSource.java:96)
at com.hadoit.game.common.framework.nosql.redis.JedisTemplate.getJedis(JedisTemplate.java:63)
at com.hadoit.game.common.framework.nosql.redis.JedisTemplate.execute(JedisTemplate.java:77)
at com.gamejelly.gong.tools.HefuDataTools.getBAllLltRankData(HefuDataTools.java:548)
at com.gamejelly.gong.tools.HefuDataTools.handleLltRank(HefuDataTools.java:487)
at com.gamejelly.gong.tools.HefuDataTools.main(HefuDataTools.java:468)
Caused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused
at redis.clients.jedis.Connection.connect(Connection.java:137)
at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:65)
at redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1706)
at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:28)
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1188)
at redis.clients.util.Pool.getResource(Pool.java:38)
... 6 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at redis.clients.jedis.Connection.connect(Connection.java:132)
... 11 more
情形2:密码不正确,未能正确连接
解决方法1: 开启redis-cli 设置密码
Mac 下
解决方法2: 修改项目对应配置的密码为空(默认没有密码)
redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
at redis.clients.util.Pool.getResource(Pool.java:40)
at com.hadoit.game.common.framework.nosql.redis.JedisDataSource.getResource(JedisDataSource.java:96)
at com.hadoit.game.common.framework.nosql.redis.JedisTemplate.getJedis(JedisTemplate.java:63)
at com.hadoit.game.common.framework.nosql.redis.JedisTemplate.execute(JedisTemplate.java:77)
at com.hadoit.game.common.framework.nosql.redis.JedisTemplate.get(JedisTemplate.java:257)
at com.gamejelly.gong.dbs.service.GameService.touchJedis(GameService.java:68)
at com.gamejelly.gong.dbs.proxy.DbsServerProxySqlImpl.onRegistered(DbsServerProxySqlImpl.java:42)
at com.hadoit.game.engine.guardian.dbs.DbsManager.doStart(DbsManager.java:97)
at com.hadoit.game.engine.guardian.core.GuardianContainer.start(GuardianContainer.java:123)
at com.gamejelly.gong.dbs.DbsApp.main(DbsApp.java:32)
Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set
at redis.clients.jedis.Protocol.processError(Protocol.java:66)
at redis.clients.jedis.Protocol.process(Protocol.java:73)
at redis.clients.jedis.Protocol.read(Protocol.java:138)
at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:165)
at redis.clients.jedis.BinaryJedis.auth(BinaryJedis.java:2104)
at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:30)
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1188)
at redis.clients.util.Pool.getResource(Pool.java:38)
... 9 more
最后
以上就是狂野导师为你收集整理的[Exception] redis.clients.jedis.exceptions.JedisConnectionException的全部内容,希望文章能够帮你解决[Exception] redis.clients.jedis.exceptions.JedisConnectionException所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复