springmvc redis 项目链接redis客户端时失败,报一下异常:
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的客户端默认密码为空,但是现在你修改了redis的密码。
解决方法:修改在spring-content配置的redis,去掉密码配置(p:password="xx")就行了。
原文件:
<!-- redis工厂 -->
<bean id="jedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
p:host-name="127.0.0.1" p:port="6379" p:password="123456"/>
修改后:
<!-- redis工厂 -->
<bean id="jedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
p:host-name="127.0.0.1" p:port="6379"/>