fastjson 1.2.62 版本 报错JavaBeanSerializer.processValue

0s7z1bwu  于 2021-11-27  发布在  Java
关注(0)|答案(6)|浏览(573)

单独在main方法里面运行这个json转换的代码没有报错,springboot .2.1.8.RELEASE 环境下 spring上下文中运行报错。

`List disBizData = new ArrayList();
QueryBudgetFreeDetailRsp rsp = new QueryBudgetFreeDetailRsp();
rsp.setBudgetDeptCode("275100");
rsp.setItemNo("275100-SD1-000000");
rsp.setExecYear("2019");
rsp.setExecMonth("10");
rsp.setBudgetFreezeId("622361");
rsp.setOprtCode("R");
rsp.setOprtAmount(new BigDecimal("1000"));
rsp.setCurrencyCode("CNY");
disBizData.add(rsp);

QueryBudgetFreeRsp queryBudgetFreeRsp = new QueryBudgetFreeRsp("1234567896422522522", disBizData);
	SimplePropertyPreFilter filter = new SimplePropertyPreFilter();
	filter.getExcludes().addAll(Arrays.asList("budgetFreezeId", "oprtCode", "oprtAmount", "execType", "messageStatus", "enabledFlag"));
	String msgContext = JSON.toJSONString(queryBudgetFreeRsp, filter);

`

报错信息如下:

**2019-10-28 19:22:23.509 [ERROR] com.csair.fcc.config.SchedulingConfiguration$$EnhancerBySpringCGLIB$$d738deda - Exception in @scheduled task.

java.lang.NoSuchMethodError: com.alibaba.fastjson.serializer.JavaBeanSerializer.processValue(Lcom/alibaba/fastjson/serializer/JSONSerializer;Lcom/alibaba/fastjson/serializer/BeanContext;Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;Ljava/lang/Integer;
at com.alibaba.fastjson.serializer.ASMSerializer_1_QueryBudgetFreeRsp.writeNormal(Unknown Source)
at com.alibaba.fastjson.serializer.ASMSerializer_1_QueryBudgetFreeRsp.write(Unknown Source)
at com.alibaba.fastjson.serializer.JSONSerializer.write(JSONSerializer.java:285)
at com.alibaba.fastjson.JSON.toJSONString(JSON.java:745)
at com.alibaba.fastjson.JSON.toJSONString(JSON.java:679)
at com.csair.fcc.budget.timer.BudgetScheduleTask.queryBudgetFree(BudgetScheduleTask.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
at java.util.concurrent.FutureTask.run(FutureTask.java)
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)

**

rsl1atfo

rsl1atfo1#

我也遇到这个问题,idea启动报错,打包运行正常。

gwo2fgha

gwo2fgha2#

我也是一样,idea能正常启动,运行异常,测试环境正常。

j91ykkif

j91ykkif3#

同样的问题,返回查询数据序列化失败

to94eoyn

to94eoyn5#

执行序列化 JSON.toJSONBytes(value, SerializerFeature.WriteClassName); 报同样的错,1.2.60没问题

8ulbf1ek

8ulbf1ek6#

通过ASM生成序列化类的时候有问题。这个commit已经修复。
e05f1f9

相关问题