I am connecting redis server from my machine using java Jedis. I am trying to do sadd which is already provided by Jedis.
But I am getting an exception as
WRONGTYPE Operation against a key holding the wrong kind of value
Error trace
JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();jedisPoolConfig.setMaxTotal(120);Jedis j = new JedisPool(jedisPoolConfig, RedisDBConfig.HOST, RedisDBConfig.PORT, RedisDBConfig.TIMEOUT, RedisDBConfig.PASSWORD).getResource(); try{ Long result = j.sadd( key,values); System.out.println("Result for keyName "+ key +" is "+result ); }catch (Exception ex1){ System.out.println(ex1.getMessage()); return false; }finally { } return true;
Add more in this.j.set and j.map
command is working fine.
Value which I trying to input isj.sadd("key", "val1", "val2);