2021-08-20 03:11:07.034 [Thread-4] ERROR c.a.otter.canal.adapter.launcher.loader.AdapterProcessor - Outer adapter sync failed! Error sync and rollback, execute times: 1 2021-08-20 03:11:08.037 [pool-11-thread-1] INFO c.a.o.canal.client.adapter.logger.LoggerAdapterExample - DML: {"data":[{"id":"133190FF23384846BCE9B12A71C7F7AB","data_type":"0","method_code":"62-5","data_id":"2575477","user_id":"13234","product_code":"123456543","status":0,"error_message":null,"create_date":1585376951000,"update_date":1585376951000,"region":null,"org_id":"1212","sync_type":67,"weight":67}],"database":"sp","destination":"example","es":1629429066000,"groupId":"g1","isDdl":false,"old":null,"pkNames":["id"],"sql":"","table":"phms_sync_data_20200804","ts":1629429068035,"type":"INSERT"} 2021-08-20 03:11:08.045 [pool-11-thread-1] ERROR c.a.otter.canal.adapter.launcher.loader.AdapterProcessor - java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.NullPointerException java.lang.RuntimeException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.NullPointerException 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_292] 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_292] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_292] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_292] at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_292] Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.NullPointerException 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_292] 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.RdbSyncService.sync(RdbSyncService.java:153) ~[na:na] at com.alibaba.otter.canal.client.adapter.rdb.RdbAdapter.sync(RdbAdapter.java:168) ~[na:na] ... 8 common frames omitted Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:1.8.0_292] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[na:1.8.0_292] 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: java.lang.NullPointerException at com.alibaba.otter.canal.client.adapter.rdb.service.RdbSyncService.lambda$sync$1(RdbSyncService.java:124) ~[na:na] ... 4 common frames omitted Caused by: java.lang.NullPointerException: null at com.alibaba.otter.canal.client.adapter.rdb.service.RdbSyncService.insert(RdbSyncService.java:250) ~[na:na] at com.alibaba.otter.canal.client.adapter.rdb.service.RdbSyncService.sync(RdbSyncService.java:214) ~[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_292] at com.alibaba.otter.canal.client.adapter.rdb.service.RdbSyncService.lambda$sync$1(RdbSyncService.java:115) ~[na:na] ... 4 common frames omitted 2021-08-20 03:11:08.045 [Thread-4] ERROR c.a.otter.canal.adapter.launcher.loader.AdapterProcessor - Outer adapter sync failed! Error sync but ACK!
原提问者GitHub用户hyhwl
我找到原因了
dataSourceKey: defaultDS # 源数据源的key, 对应上面配置的srcDataSources中的值 destination: example # cannal的instance或者MQ的topic groupId: g1 # 对应MQ模式下的groupId, 只会同步对应groupId的数据 outerAdapterKey: mysql1 # adapter key, 对应上面配置outAdapters中的key concurrent: true # 是否按主键hash并行同步, 并行同步的表必须保证主键不会更改及主键不能为其他同步表的外键!! dbMapping: database: sp # 源数据源的database/shcema table: sync_data # 源数据源表名 targetTable: sync_data # 目标数据源的库名.表名 targetPk: # 主键映射 id: id # 如果是复合主键可以换行映射多个 mapAll: true # 是否整表映射, 要求源表和目标表字段名一模一样 etlCondition: "where c_time>={}" commitBatch: 3000
mapAll: true 这个如果开启 就会报空指针
targetColumns 还是用这个指明每个字段
原回答者GitHub用户hyhwl
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。