RedisTemplate nullPointException

问题描述

我正在使用 jedis 和 redistemplate 库,但是当我声明哈希操作 hashOps 并尝试获取值时,我想出了 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:"); 

在最后一行,我得到了 Null Exception。 redistemplate 和 jedisConnectionFactory 都不为空。我错过了什么吗???任何帮助将不胜感激

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)