[FastJson] FastJson parsing serializer error/deserializer error

Today, FastJson parses the serializer error/deserializer error, such as the following:

com.alibaba.fastjson.JSONException: create asm deserializer error, com.dituwuyou.bean.User
    at com.alibaba.fastjson.parser.ParserConfig.createJavaBeanDeserializer(ParserConfig.java:529)
    at com.alibaba.fastjson.parser.ParserConfig.getDeserializer(ParserConfig.java:430)
    at com.alibaba.fastjson.parser.ParserConfig.getDeserializer(ParserConfig.java:351)
    at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:548)
    at com.alibaba.fastjson.JSON.parseObject(JSON.java:251)
    at com.alibaba.fastjson.JSON.parseObject(JSON.java:227)
    at com.alibaba.fastjson.JSON.parseObject(JSON.java:186)
    at com.alibaba.fastjson.JSON.parseObject(JSON.java:304)
    at com.dituwuyou.service.impl.UserService.getUserInfo(UserService.java:108)
    at com.dituwuyou.service.impl.UserService.bindUmengNotifacation(UserService.java:80)
    at com.dituwuyou.service.impl.UserService_.access$001(UserService_.java:11)
    at com.dituwuyou.service.impl.UserService_$1.execute(UserService_.java:44)
    at org.androidannotations.api.BackgroundExecutor$Task.run(BackgroundExecutor.java:393)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
.....................................................................

In fact, there are too many fields...

The solution is as follows:

  • 1. Add configuration: ParserConfig.getGlobalInstance().setAsmEnable(false);( reference )
  • 2. Focus on it. Just upgrade or lower the fastjson version. At present, I tested the 1.2.6 version and it did not report an error. Very strange, the 1.2.66 version reports an error, adding the configuration does not report an error, the 1.2.6 version removes the configuration and does not report an error, it is estimated that the version is wrong!

Guess you like

Origin blog.csdn.net/qq_45797116/article/details/114702568