alibaba / alibaba/DataX

使用mysqlreader和mysqlwriter的时候,注意fastjson2的版本

Open
#1,777 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
17.4k
Forks
5.7k
PR merge metrics
No merged PRs in 30d

Description

1、背景:很简单的本地mysql的读入写进。
2、问题:test.json文件已经确定是正确的json格式了,但是在idea的控制台日志中会发现解析出来的json多了一个逗号。
![img_v2_b8cc37ed-74af-49a4-aa7f-ebce41da278g](https://user-images.githubusercontent.com/38486240/236364831-bf08e4f3-afc3-440d-b4e7-bd564c9087c1.jpg)

3、报错日志如下:
com.alibaba.datax.common.exception.DataXException: Code:[Common-00], Describe:[您提供的配置文件存在错误信息,请检查您的作业配置 .] - 配置信息错误. 您提供的配置信息不是合法的JSON格式: offset 40, character ,, line 1, column 41, fastjson-version 2.0.15 {"username":"root","password":"123456",,"fetchSize":-2147483648,"isTableMode":false,"tableNumber":0,"jdbcUrl":"jdbc:mysql://127.0.0.1:3310/test_01?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&yearIsDateType=false&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=false&rewriteBatchedStatements=true","loadBalanceResourceMark":"127.0.0.1"} . 请按照标准json格式提供配置信息.
at com.alibaba.datax.common.exception.DataXException.asDataXException(DataXException.java:30)
at com.alibaba.datax.common.util.Configuration.(Configuration.java:1075)
at com.alibaba.datax.common.util.Configuration.from(Configuration.java:79)
at com.alibaba.datax.common.util.Configuration.clone(Configuration.java:703)
at com.alibaba.datax.plugin.rdbms.reader.util.ReaderSplitUtil.doSplit(ReaderSplitUtil.java:103)
at com.alibaba.datax.plugin.rdbms.reader.CommonRdbmsReader$Job.split(CommonRdbmsReader.java:103)
at com.alibaba.datax.plugin.reader.mysqlreader.MysqlReader$Job.split(MysqlReader.java:49)
at com.alibaba.datax.core.job.JobContainer.doReaderSplit(JobContainer.java:733)
at com.alibaba.datax.core.job.JobContainer.split(JobContainer.java:394)
at com.alibaba.datax.core.job.JobContainer.start(JobContainer.java:117)
at com.alibaba.datax.core.Engine.start(Engine.java:86)
at com.alibaba.datax.core.Engine.entry(Engine.java:168)

4、解决办法:修改pom文件中的fastjson2版本号就可以
![image](https://user-images.githubusercontent.com/38486240/236365149-09a18072-4af2-4a7d-bd0e-550f18d39770.png)

5、成功日志:
![image](https://user-images.githubusercontent.com/38486240/236365191-f4c935d7-bacf-46cd-a189-0eec675fb3b6.png)

Contributor guide

No contributing guide indexed for this repository

Research direction

Review the pom file and the mysqlreader/mysqlwriter dependency setup, starting with the fastjson2 version implicated in the issue. Reproduce the local MySQL read/write configuration and verify whether the generated JSON contains the extra comma; done means the configuration parses successfully and the job completes without the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, mysql
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.