NOAUTH需要身份验证

时间:2014-05-14 08:09:48

标签: apache

在我使用密码保护配置redis后,我得到以下错误

Exception Occured 
Exception Message --> NOAUTH Authentication required.
Exception Cause --> redis.clients.jedis.exceptions.JedisDataException: NOAUTH Authentication required.
File Name : SecurityInterceptor.java    
Class Name : org.tcs.com.security.filter.SecurityInterceptor
Method Name : doFilter

5 个答案:

答案 0 :(得分:6)

  

redis.clients.jedis.exceptions.JedisDataException

表示 jedis (java Redis客户端)用于连接Redis服务器。

  

“NOAUTH Authentication required error”

表示jedis连接需要密码才能进行身份验证。

以下java代码段显示了如何设置密码:

JedisShardInfo shardInfo = new JedisShardInfo(redisHost, redisPort);
shardInfo.setPassword(redisPassword);
Jedis jedis = new Jedis(shardInfo);
jedis.connect();

答案 1 :(得分:1)

将您的密码属性添加到Tomcat context.xml中的块..

答案 2 :(得分:0)

  public JedisPool(final Config poolConfig, final String host, int port,
        int timeout, final String password) {
    this(poolConfig, host, port, timeout, password, Protocol.DEFAULT_DATABASE);
}

这种方法可能对你有帮助。

答案 3 :(得分:0)

该消息具有误导性。提案是

  

错误NOAUTH-需要验证

答案 4 :(得分:0)

String cacheHostname = "your cash host";
String cachekey = "your cash primary key";
JedisShardInfo shardInfo = new JedisShardInfo(cacheHostname, 6379);
shardInfo.setPassword(cachekey);
Jedis jedis = new Jedis(shardInfo);
jedis.auth(cachekey);
jedis.connect();
System.out.println( "Cache Response : " + jedis.ping());