开发者社区> 问答> 正文

DML操作,adapter报FastJson错误,本地复现却复现不了

环境信息

canal v1.1.5 mysql 5.7 adapter v1.1.4

问题描述

一张表同步不成功,Adapter SyncDB报错

步骤重现

DML操作

If there is an exception, please attach the exception trace:

2022-03-15 02:41:37.309 [pool-46-thread-1] ERROR c.a.otter.canal.adapter.launcher.loader.AdapterProcessor - java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: com.alibaba.fastjson.JSONException: write javaBean error, fastjson version 1.2.58, class com.alibaba.otter.canal.client.adapter.rdb.support.SingleDml java.lang.RuntimeException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: com.alibaba.fastjson.JSONException: write javaBean error, fastjson version 1.2.58, class com.alibaba.otter.canal.client.adapter.rdb.support.SingleDml at com.alibaba.otter.canal.client.adapter.rdb.RdbAdapter.sync(RdbAdapter.java:171) ~[na:na] at com.alibaba.otter.canal.adapter.launcher.loader.AdapterProcessor.batchSync(AdapterProcessor.java:139) ~[client-adapter.launcher-1.1.5.jar:na] at com.alibaba.otter.canal.adapter.launcher.loader.AdapterProcessor.lambda$null$1(AdapterProcessor.java:97) ~[client-adapter.launcher-1.1.5.jar:na] at java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:895) ~[na:1.8.0_301] at com.alibaba.otter.canal.adapter.launcher.loader.AdapterProcessor.lambda$null$2(AdapterProcessor.java:94) ~[client-adapter.launcher-1.1.5.jar:na] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_301] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_301] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_301] at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_301] Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: com.alibaba.fastjson.JSONException: write javaBean error, fastjson version 1.2.58, class com.alibaba.otter.canal.client.adapter.rdb.support.SingleDml at com.alibaba.otter.canal.client.adapter.rdb.service.RdbSyncService.lambda$sync$2(RdbSyncService.java:133) ~[na:na] at java.util.ArrayList.forEach(ArrayList.java:1259) ~[na:1.8.0_301] at com.alibaba.otter.canal.client.adapter.rdb.service.RdbSyncService.sync(RdbSyncService.java:129) ~[na:na] at com.alibaba.otter.canal.client.adapter.rdb.service.RdbMirrorDbSyncService.sync(RdbMirrorDbSyncService.java:83) ~[na:na] at com.alibaba.otter.canal.client.adapter.rdb.RdbAdapter.sync(RdbAdapter.java:169) ~[na:na] ... 8 common frames omitted Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: com.alibaba.fastjson.JSONException: write javaBean error, fastjson version 1.2.58, class com.alibaba.otter.canal.client.adapter.rdb.support.SingleDml at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:1.8.0_301] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[na:1.8.0_301] at com.alibaba.otter.canal.client.adapter.rdb.service.RdbSyncService.lambda$sync$2(RdbSyncService.java:131) ~[na:na] ... 12 common frames omitted Caused by: java.lang.RuntimeException: com.alibaba.fastjson.JSONException: write javaBean error, fastjson version 1.2.58, class com.alibaba.otter.canal.client.adapter.rdb.support.SingleDml at com.alibaba.otter.canal.client.adapter.rdb.service.RdbSyncService.lambda$sync$1(RdbSyncService.java:124) ~[na:na] ... 4 common frames omitted Caused by: com.alibaba.fastjson.JSONException: write javaBean error, fastjson version 1.2.58, class com.alibaba.otter.canal.client.adapter.rdb.support.SingleDml at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(JavaBeanSerializer.java:523) ~[fastjson-1.2.58.sec06.jar:na] at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(JavaBeanSerializer.java:160) ~[fastjson-1.2.58.sec06.jar:na] at com.alibaba.fastjson.serializer.JSONSerializer.write(JSONSerializer.java:285) ~[fastjson-1.2.58.sec06.jar:na] at com.alibaba.fastjson.JSON.toJSONString(JSON.java:658) ~[fastjson-1.2.58.sec06.jar:na] at com.alibaba.fastjson.JSON.toJSONString(JSON.java:647) ~[fastjson-1.2.58.sec06.jar:na] at com.alibaba.otter.canal.client.adapter.rdb.service.RdbSyncService.sync(RdbSyncService.java:223) ~[na:na] at com.alibaba.otter.canal.client.adapter.rdb.service.RdbSyncService.lambda$null$0(RdbSyncService.java:115) ~[na:na] at java.util.ArrayList.forEach(ArrayList.java:1259) ~[na:1.8.0_301] at com.alibaba.otter.canal.client.adapter.rdb.service.RdbSyncService.lambda$sync$1(RdbSyncService.java:115) ~[na:na] ... 4 common frames omitted Caused by: java.lang.ArithmeticException: null

原提问者GitHub用户curtiseng

展开
收起
后端老大 2023-04-26 16:25:08 197 0
1 条回答
写回答
取消 提交回答
  • fastjson序列化问题,可能是日期序列化错误。注释掉DML的debug输出就不报错了。

    源码替换,把对应版本源码拉下来,adapter里有两处打印SingleDml的Debug日志,里面用到fastjson序列化SingleDml,我直接注释掉了,然后编译后,替换对应的那个jar包到生产环境就可以了,调日志级别应该也可以

    原回答者GitHub用户curtiseng

    2023-04-26 18:47:47
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载