Redisson Spring - Unexpected exception while processing command

 出现这个问题可排查下redis对应的key值是否在缓存中已经存在,且与格式要求不符。

@Autowired
private RedisProperties redisProperties;

private final int SINGLE_IP_NODE = 8;

@Value("${spring.redis.mode:cluster}")
String redisMode;

@Bean
public RedissonClient redissonClient() {
    if("cluster".equals(redisMode)){
        Config config = new Config();
        String ip = redisProperties.getHost();
        String[] ipList = ip.split(";");
RedissonClient redissonClient = AppContext.getBean(RedissonClient.class);
RLock lock = redissonClient.getLock(key);

lock.lock(90000L, TimeUnit.MILLISECONDS);
try {
    RBucket<Map<String, Object>> bucket = redissonClient.getBucket(SNOW_FLAKED_ID + "_KEY");
    Map<String, Object> map = bucket.get();
    int workId = 0;
}

 

 用redisson生成雪花id,项目启动的时候一直报错,排查很久配置都没问题,才想起之前由于配置redis有问题,已经生成过错误格式的key(SNOW_FLAKED_ID + "_KEY")对应的bucket,修改redis的key后项目正常启动。

 org.redisson.client.RedisException: Unexpected exception while processing command
    at com.abi.claimbook.controller.AuthController.checkLoginCredentials(AuthController.java:97)
    at com.abi.claimbook.controller.AuthController$$FastClassBySpringCGLIB$$f6e9fa9a.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
....
....
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值