【redis】WRONGTYPE Operation against a key holding the wrong kind of value

2018-04-27 15:01:50.141|ERROR|EvMessageListener|Receive MsgId:AC110006000D30F39991868BAA7BBF6B tag:1 status:ReconsumeLater
redis.clients.jedis.exceptions.JedisDataException: WRONGTYPE Operation against a key holding the wrong kind of value
	at redis.clients.jedis.Protocol.processError(Protocol.java:117)
	at redis.clients.jedis.Protocol.process(Protocol.java:151)
	at redis.clients.jedis.Protocol.read(Protocol.java:205)
	at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:297)
	at redis.clients.jedis.Connection.getIntegerReply(Connection.java:222)
	at redis.clients.jedis.Jedis.hset(Jedis.java:606)
	at com.extracme.evready.busi.service.ServiceMessage.updateStakeRedisInfo(ServiceMessage.java:233)
	at com.extracme.evready.busi.service.ServiceMessage.handerMessage(ServiceMessage.java:139)
	at com.extracme.evready.busi.service.ServiceMessage$$FastClassBySpringCGLIB$$63c3ab5e.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)^C
	at org.springframework.transaction.interceptor.T
/**
		 * 2:控制模式 - 自动下发补偿机制 状态的有效时间
		 */
		String key_expire = RedisCarportCloumn.MODE_EXPIRE_PREFIX + result.getGridStakeSeq();
//		jedis.hset(key_expire,CommonConstant.SEND_TIMES_KEY, CommonConstant.SEND_STAKE_MSG_TIMES);//限制主动下发次数
		jedis.hset(key_expire,"SEND_TIMES","3");//限制主动下发次数
//		jedisCluster.hset(key_expire,CommonConstant.SEND_TIMES_KEY, CommonConstant.SEND_STAKE_MSG_TIMES);//限制主动下发次数
		}
		jedis.close();

hset看起来没有值类型不对的样子。后来发现原来是因为redis数据库中已经存在了相同的key, 而且key对应的值类型并不是Hashkey;再调用hset时,就会抛出此错误。(ps:忽想起来,最初设置的key-val   ,后面改为hash-val)

把原来的数据清掉,重新运行就没问题了。



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值