I am working with jedis and redisTemplate library but when I declare hashoperations hashOps and trying to get values, I came up with NullPointExteption.
RedisTemplate<String, String> redisTemplate2 = new RedisTemplate<>(); JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory(); jedisConnectionFactory.setUsePool(true); jedisConnectionFactory.setHostName("100.100.101.102"); jedisConnectionFactory.setPort(9999); redisTemplate2.setConnectionFactory(jedisConnectionFactory); redisTemplate2.setDefaultSerializer(new StringRedisSerializer()); System.out.println(redisTemplate2); HashOperations<String, String, String> hashOps = redisTemplate2.opsForHash(); List<String> result = hashOps.values("chat_content:");
On the last line I got Null Exception. Neither redisTemplate nor jedisConnectionFactory are empty. Am I missed Something??? Any help would be thanks