fastjson2 [BUG]GenericFastJsonRedisSerializer序列化异常

cmssoen2  于 2022-12-31  发布在  Redis
关注(0)|答案(5)|浏览(796)

版本:2.0.12-SNAPSHOT

2.0.12前的版本还正常,越升级,旧问题又出现了

异常:

org.springframework.data.redis.serializer.SerializationException: Could not deserialize: read field error : storeCoupons, offset 15080, character [, line 1, column 15081, fastjson-version 2.0.12 (查看json附件)
at com.alibaba.fastjson2.support.spring.data.redis.GenericFastJsonRedisSerializer.deserialize(GenericFastJsonRedisSerializer.java:71)
at org.springframework.data.redis.core.AbstractOperations.deserializeValue(AbstractOperations.java:360)
at org.springframework.data.redis.core.AbstractOperations$ValueDeserializingRedisCallback.doInRedis(AbstractOperations.java:62)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:224)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:191)
at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:97)
at org.springframework.data.redis.core.DefaultValueOperations.get(DefaultValueOperations.java:54)
at com.rssp.cache.RedisUtils.get(RedisUtils.java:32)
at com.rssp.listener.OrderMessageListener.orderStatusEvent(OrderMessageListener.java:61)
at com.rssp.listener.OrderMessageListener.onMessage(OrderMessageListener.java:44)
at com.rssp.listener.OrderMessageListener.onMessage(OrderMessageListener.java:25)
at org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer.handleMessage(DefaultRocketMQListenerContainer.java:449)
at org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer.access$100(DefaultRocketMQListenerContainer.java:71)
at org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer$DefaultMessageListenerConcurrently.consumeMessage(DefaultRocketMQListenerContainer.java:409)
at org.apache.rocketmq.client.impl.consumer.ConsumeMessageConcurrentlyService$ConsumeRequest.run(ConsumeMessageConcurrentlyService.java:402)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
Caused by: com.alibaba.fastjson2.JSONException: read field error : storeCoupons, offset 15080, character [, line 1, column 15081, fastjson-version 2.0.12 (查看json附件)
at com.alibaba.fastjson2.reader.FieldReaderObjectMethod.readFieldValue(FieldReaderObjectMethod.java:129)
at com.alibaba.fastjson2.reader.ObjectReaderBean.readObject(ObjectReaderBean.java:235)
at com.alibaba.fastjson2.reader.ObjectReaderImplObject.readObject(ObjectReaderImplObject.java:88)
at com.alibaba.fastjson2.JSON.parseObject(JSON.java:949)
at com.alibaba.fastjson2.support.spring.data.redis.GenericFastJsonRedisSerializer.deserialize(GenericFastJsonRedisSerializer.java:68)
... 19 common frames omitted
Caused by: com.alibaba.fastjson2.JSONException: illegal character [, offset 15080, character [, line 1, column 15081, fastjson-version 2.0.12 (查看json附件)
at com.alibaba.fastjson2.JSONReaderUTF8.readFieldNameHashCode(JSONReaderUTF8.java:378)
at com.alibaba.fastjson2.reader.ObjectReaderNoneDefaultConstrutor.readObject(ObjectReaderNoneDefaultConstrutor.java:215)
at com.alibaba.fastjson2.reader.ObjectReaderImplMapTyped.readObject(ObjectReaderImplMapTyped.java:274)
at com.alibaba.fastjson2.reader.FieldReaderObjectMethod.readFieldValue(FieldReaderObjectMethod.java:126)
... 23 common frames omitted

JSON文件:
json.txt

oyt4ldly

oyt4ldly1#

这个问题好像反反复复😂

nkkqxpd9

nkkqxpd92#

storeRemark在对象中是什么类型?这个类的代码能发一下么?

yzxexxkh

yzxexxkh3#

https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.13-SNAPSHOT/
帮用2.0.13版本快照重新测试下,这个版本补充了更多的错误信息,用于方便诊断

g6baxovj

g6baxovj4#

storeRemark

storeRemark是StoreRemarkDTO 的泛型List
private List storeRemark;

@DaTa
public class StoreRemarkDTO implements Serializable {

private static final long serialVersionUID = -6793274046513576434L;

private String storeId;

private String remark;

}

zlwx9yxi

zlwx9yxi5#

问题无法重现,需要你帮忙构造重现问题的testcase

相关问题