开发者社区> 问答> 正文

使用datax做mysql到mysql的数据迁移 报错 com.alibaba.fastjson.JSONObject cannot be cast to java.lang.String 求解

使用Datax进行数据迁移行报错,经DataX智能分析,该任务最可能的错误原因是:
com.alibaba.datax.common.exception.DataXException: Code:[Framework-02], Description:[DataX引擎运行过程出错,具体原因请参看DataX运行结束时的错误诊断信息 .]. - java.lang.ClassCastException: com.alibaba.fastjson.JSONObject cannot be cast to java.lang.String
请问是什么原因
我的mysql.json 配置如下

{
    "job": {
        "content": [
            {
                "reader": {
                    "name": "mysqlreader", 
                    "parameter": {
                        "sliceRecordCount": 10, 
                        "column": [
                            "*"
                        ], 
                        "connection": [
                            {
                                "jdbcUrl": [
                                    "jdbc:mysql://10.xxx.xx.xxx:3306/xxxxx"
                                ], 
                                "table": [
                                    "auth_user_user_permissions"
                                ]
                            }
                        ], 
                        "password": "xxxxx", 
                        "username": "xxxx"
                    }
                }, 
                "writer": {
                    "name": "mysqlwriter", 
                    "parameter": {
                        "encoding": "UTF-8", 
                        "column": [
                            {
                                "name": "id", 
                                "type": "INT"
                            }, 
                            {
                                "name": "user_id", 
                                "type": "INT"
                            }, 
                            {
                                "name": "permission_id", 
                                "type": "INT"
                            }
                        ], 
                        "connection": [
                            {
                                "jdbcUrl": "jdbc:mysql://10.xxx.xx.xxxx:3306/xxxx", 
                                "table": [
                                    "test"
                                ]
                            }
                        ], 
                        "password": "xxxxx", 
                        "username": "xxxx"
                    }
                }
            }
        ], 
        "setting": {
            "speed": {
                "channel": 5
            }
        }
    }
}

QQ_20180914144755
QQ_20180914144859

展开
收起
氨基钠 2018-09-14 14:52:45 19614 0
1 条回答
写回答
取消 提交回答
  • 自由散漫的开发者,哇哈哈

    writer的jdbcUrl写的有问题,改成和reader的数组写法
    参考地址:https://github.com/alibaba/DataX/issues/133

    "connection": [
                                {
                                    "jdbcUrl":[
     "jdbc:mysql://10.xxx.xx.xxxx:3306/xxxx"] ,
                                    "table": [
                                        "test"
                                    ]
                                }
                            ], 
    2019-07-17 23:05:12
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Spring Cloud Alibaba - 重新定义 Java Cloud-Native 立即下载
The Reactive Cloud Native Arch 立即下载
JAVA开发手册1.5.0 立即下载

相关镜像