redis异常解决:jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set

原创 2015年09月10日 19:47:42

项目中用到了redis做缓存服务器,今天一次重启后报出下面的异常,经过各种排查,定位原因如下,作记录以备忘。

异常如下:


redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
redis.clients.util.Pool.getResource(Pool.java:50)
redis.clients.jedis.JedisPool.getResource(JedisPool.java:88)
com.radiadesign.catalina.session.RedisSessionManager.acquireConnection(RedisSessionManager.java:107)
com.radiadesign.catalina.session.RedisSessionManager.loadSessionFromRedis(RedisSessionManager.java:388)
com.radiadesign.catalina.session.RedisSessionManager.findSession(RedisSessionManager.java:330)
org.apache.catalina.connector.Request.doGetSession(Request.java:2981)
org.apache.catalina.connector.Request.getSessionInternal(Request.java:2599)
com.radiadesign.catalina.session.RedisSessionHandlerValve.invoke(RedisSessionHandlerValve.java:28)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1739)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1698)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:745)
root cause

redis.clients.jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set
redis.clients.jedis.Protocol.processError(Protocol.java:113)
redis.clients.jedis.Protocol.process(Protocol.java:138)
redis.clients.jedis.Protocol.read(Protocol.java:192)
redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:282)
redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:181)
redis.clients.jedis.BinaryJedis.auth(BinaryJedis.java:1930)
redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:71)
org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:819)
org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:429)
org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:360)
redis.clients.util.Pool.getResource(Pool.java:48)
redis.clients.jedis.JedisPool.getResource(JedisPool.java:88)
com.radiadesign.catalina.session.RedisSessionManager.acquireConnection(RedisSessionManager.java:107)
com.radiadesign.catalina.session.RedisSessionManager.loadSessionFromRedis(RedisSessionManager.java:388)
com.radiadesign.catalina.session.RedisSessionManager.findSession(RedisSessionManager.java:330)
org.apache.catalina.connector.Request.doGetSession(Request.java:2981)
org.apache.catalina.connector.Request.getSessionInternal(Request.java:2599)
com.radiadesign.catalina.session.RedisSessionHandlerValve.invoke(RedisSessionHandlerValve.java:28)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1739)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1698)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:745)

问题原因看起来很清楚,就是这句: ERR Client sent AUTH, but no password is set

它的意思就是redis服务器没有设置密码,但客户端向其发送了AUTH请求,于是把程序中所有jedis发送授权的地方都去掉,可是发现异常还是存在!!简直无语了

最后想起在tomcat中还有同步session到redis的配置,这里还设置了password,而且即使是空“”也不行。把整个password干掉,重启,ok啦!

<Valve className="com.radiadesign.catalina.session.RedisSessionHandlerValve" />
      <Manager className="com.radiadesign.catalina.session.RedisSessionManager"
               host="172.11.22.33" password="" port="6379" database="5" maxInactiveInterval="60" />

另外:关于redis的启动方式:

1、指定配置文件 $: ./redis-server /usr/local/redis.conf

2、不指定配置:$: ./redis-server &

不指定配置文件启动时采用默认配置,无密码

redis通过属性requirepass 设置访问密码,但没有设置该属性时,客户端向服务端发送AUTH请求,服务端就好返回异常:ERR Client sent AUTH, but no password is set

相关文章推荐

Java链接Redis时出现 “ERR Client sent AUTH, but no password is set” 异常的原因及解决办法

Java链接Redis时出现 “ERR Client sent AUTH, but no password is set” 异常的原因及解决办法 【错误提示】 redis.clients....
  • iw1210
  • iw1210
  • 2017年05月17日 20:09
  • 2088

redis.clients.jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set

使用哨兵模式连接redis连接池时,遇到一下错误: Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR Client s...

redis异常解决:jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set

springmvc redis 项目链接redis客户端时失败,报一下异常: redis.clients.jedis.exceptions.JedisDataException: ERR Clien...

redis.clients.jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set

它的意思就是redis服务器没有设置密码,但客户端向其发送了AUTH请求, 这个原因可能是服务器启动没有用配置文件启动 redis以配置文件启动: 先找到配置文件 root@iZ...

Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password

在对redis 做测试的时候遇到以上问题,经过排查问题出现在,redis的启动方式。   第一种是使用服务端命令   ./redis-server 这种方式启动 默认无密码  ,如果在写...

Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password

Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password ...

redis存储tomcat共享session异常:redis.clients.jedis.exceptions.JedisDataException: NOAUTH Authentication

redis存储tomcat session异常, NOAUTH Authentication required

Redis 设置密码登录

关于Redis设置登录密码

redis.clients.jedis.exceptions.JedisDataException: NOAUTH Authentication required.

在用jedis集群中,用ShardedJedisPool对主从进行hash算法选取redis服务端,然而我在redis主从都设置了密码,在配置连接时报如下错误 redis.clients.jedis...

首次用java连接redis出现的问题

1.连接用java连接redis时报如下错误,连接超时 Exception in thread "main" redis.clients.jedis.exceptions.JedisConnecti...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:redis异常解决:jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set
举报原因:
原因补充:

(最多只允许输入30个字)