title: FastJson 解析报错deserializer error
date: 2015-08-24 19:59:08
categories: ANDROID
tags: fastjson
小小程序猿
我的博客:http://daycoding.com
junit 测试解析json数据报错
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) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at com.alibaba.fastjson.parser.deserializer.ASMDeserializerFactory.createJavaBeanDeserializer(ASMDeserializerFactory.java:110) at com.alibaba.fastjson.parser.ParserConfig.createJavaBeanDeserializer(ParserConfig.java:520) ... 19 more Caused by: java.lang.LinkageError: com/alibaba/fastjson/parser/ParserConfig at com.alibaba.fastjson.parser.deserializer.ASMJavaBeanDeserializer.createFieldDeserializer(ASMJavaBeanDeserializer.java:41) at com.alibaba.fastjson.parser.deserializer.ASMJavaBeanDeserializer$InnerJavaBeanDeserializer.createFieldDeserializer(ASMJavaBeanDeserializer.java:90) at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.addFieldDeserializer(JavaBeanDeserializer.java:82) at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.<init>(JavaBeanDeserializer.java:47) at com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.<init>(JavaBeanDeserializer.java:38) at com.alibaba.fastjson.parser.deserializer.ASMJavaBeanDeserializer$InnerJavaBeanDeserializer.<init>(ASMJavaBeanDeserializer.java:81) at com.alibaba.fastjson.parser.deserializer.ASMJavaBeanDeserializer$InnerJavaBeanDeserializer.<init>(ASMJavaBeanDeserializer.java:78) at com.alibaba.fastjson.parser.deserializer.ASMJavaBeanDeserializer.<init>(ASMJavaBeanDeserializer.java:16) at Fastjson_ASM_User_2.<init>(Unknown Source) ... 25 more
解决方案
设置ParserConfig.getGlobalInstance().setAsmEnable(false);