Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlserverreader Exception when job run java.lang.String cannot be cast to java.util.List #2219

Open
huangzhb opened this issue Sep 27, 2024 · 1 comment

Comments

@huangzhb
Copy link

{
"job": {
"setting": {
"speed": 1048576
},
"content": [
{
"reader": {
"name": "sqlserverreader",
"parameter": {
"username": "sa",
"password": "****",
"connection": [
{
"querySql": [
"select 'EMPLOYEE' as 数据表, '' as 字段名, 'BH='+t.BH+'---重复' as 错误内容 from EMPLOYEE t where 1!=1;"
],
"jdbcUrl": [
"jdbc:sqlserver://:1433;DatabaseName=dt_bjh"
]
}
]
}
},
"writer": {
"name": "rdbmswriter",
"parameter": {
"connection": [{
"jdbcUrl": "jdbc:h2:tcp://
/importer",
"table": ["校验信息表"]
}],
"username": "sa",
"password": "*****",
"column": [
"数据表", "字段名", "错误内容"
],
"preSql": [
"delete from 校验信息表 t where t.数据表='EMPLOYEE';"
],
"postSql": []
}
}
}
]
}
}

2024-09-27 13:42:51.134 DEBUG 36528 --- [ job-0] c.n.erp.saas.importer.liteflow.DataxJob : {"job":{"setting":{"speed":1048576},"content":[{"reader":{"name":"sqlserverreader","parameter":{"username":"sa","password":"","column":["BH"],"connection":[{"table":["EMPLOYEE"],"jdbcUrl":"jdbc:sqlserver://:1433;DatabaseName=dt_bjh"}]}},"writer":{"name":"rdbmswriter","parameter":{"connection":[{"jdbcUrl":"jdbc:h2:tcp://*****/importer","table":["校验信息表"]}],"username":"sa","password":"****","column":["数据表","字段名","错误内容"],"preSql":["delete from 校验信息表 t where t.数据表='EMPLOYEE';"],"postSql":[]}}}]},"core":{"container":{"trace":{"enable":"false"},"job":{"reportInterval":10000,"name":"01dtVerify","id":0},"taskGroup":{"channel":5}},"dataXServer":{"reportDataxLog":false,"address":"http://localhost:7001/api","timeout":10000,"reportPerfLog":false},"transport":{"exchanger":{"class":"com.alibaba.datax.core.plugin.BufferedRecordExchanger","bufferSize":32},"channel":{"byteCapacity":67108864,"flowControlInterval":20,"class":"com.alibaba.datax.core.transport.channel.memory.MemoryChannel","speed":{"byte":10485760,"record":1000},"capacity":512}},"statistics":{"collector":{"plugin":{"taskClass":"com.alibaba.datax.core.statistics.plugin.task.StdoutPluginCollector","maxDirtyNumber":10}}}},"common":{"column":{"dateFormat":"yyyy-MM-dd","datetimeFormat":"yyyy-MM-dd HH:mm:ss","timeFormat":"HH:mm:ss","extraFormats":["yyyyMMdd"],"timeZone":"GMT+8","encoding":"utf-8"}},"entry":{"jvm":"-Xms1G -Xmx1G"},"plugin":{"reader":{"sqlserverreader":{"path":"./../datax\plugin\reader\sqlserverreader","loadType":"jarLoader","name":"sqlserverreader","description":"useScene: test. mechanism: use datax framework to transport data from SQL Server. warn: The more you know about the data, the less problems you encounter.","developer":"alibaba","class":"com.alibaba.datax.plugin.reader.sqlserverreader.SqlServerReader"}},"writer":{"rdbmswriter":{"loadType":"jarLoader","path":"./../datax\plugin\writer\rdbmswriter","name":"rdbmswriter","description":"useScene: prod. mechanism: Jdbc connection using the database, execute select sql, retrieve data from the ResultSet. warn: The more you know about the database, the less problems you encounter.","developer":"alibaba","drivers":["dm.jdbc.driver.DmDriver","com.sybase.jdbc3.jdbc.SybDriver","com.edb.Driver","com.ibm.db2.jcc.DB2Driver","org.h2.Driver"],"class":"com.alibaba.datax.plugin.reader.rdbmswriter.RdbmsWriter"}}}}
2024-09-27 13:42:51.134 INFO 36528 --- [ job-0] com.alibaba.datax.core.job.JobContainer : DataX jobContainer starts job.
2024-09-27 13:42:51.138 ERROR 36528 --- [ job-0] com.alibaba.datax.core.job.JobContainer : Exception when job run
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
at com.alibaba.datax.common.util.Configuration.getList(Configuration.java:435) ~[datax-common-0.0.1-202309.jar:na]
at com.alibaba.datax.plugin.rdbms.reader.util.OriginalConfPretreatmentUtil.dealJdbcAndTable(OriginalConfPretreatmentUtil.java:85) ~[plugin-rdbms-util-0.0.1-202309.jar:na]
at com.alibaba.datax.plugin.rdbms.reader.util.OriginalConfPretreatmentUtil.simplifyConf(OriginalConfPretreatmentUtil.java:59) ~[plugin-rdbms-util-0.0.1-202309.jar:na]
at com.alibaba.datax.plugin.rdbms.reader.util.OriginalConfPretreatmentUtil.doPretreatment(OriginalConfPretreatmentUtil.java:33) ~[plugin-rdbms-util-0.0.1-202309.jar:na]
at com.alibaba.datax.plugin.rdbms.reader.CommonRdbmsReader$Job.init(CommonRdbmsReader.java:55) ~[plugin-rdbms-util-0.0.1-202309.jar:na]
at com.alibaba.datax.plugin.reader.sqlserverreader.SqlServerReader$Job.init(SqlServerReader.java:40) ~[sqlserverreader-0.0.1-202309.jar:na]
at com.alibaba.datax.core.job.JobContainer.initJobReader(JobContainer.java:673) ~[datax-core-0.0.1-202309.jar:na]
at com.alibaba.datax.core.job.JobContainer.init(JobContainer.java:303) ~[datax-core-0.0.1-202309.jar:na]
at com.alibaba.datax.core.job.JobContainer.start(JobContainer.java:113) ~[datax-core-0.0.1-202309.jar:na]
at com.alibaba.datax.core.Engine.start(Engine.java:86) [datax-core-0.0.1-202309.jar:na]
at cn.newalways.erp.saas.importer.liteflow.DataxJob.executeContext(DataxJob.java:149) [classes/:na]
at cn.newalways.erp.saas.importer.liteflow.DataxJob$executeContext.call(Unknown Source) [classes/:na]
at Script1.run(Script1.groovy:9) [script:na]
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317) [groovy-jsr223-3.0.19.jar:3.0.19]
at org.codehaus.groovy.jsr223.GroovyCompiledScript.eval(GroovyCompiledScript.java:71) [groovy-jsr223-3.0.19.jar:3.0.19]
at javax.script.CompiledScript.eval(CompiledScript.java:92) [na:1.8.0_382]
at com.yomahub.liteflow.script.jsr223.JSR223ScriptExecutor.executeScript(JSR223ScriptExecutor.java:80) [liteflow-core-2.12.0.jar:2.12.0]
at com.yomahub.liteflow.script.ScriptExecutor.execute(ScriptExecutor.java:36) [liteflow-core-2.12.0.jar:2.12.0]
at com.yomahub.liteflow.core.ScriptCommonComponent.process(ScriptCommonComponent.java:25) [liteflow-core-2.12.0.jar:2.12.0]
at com.yomahub.liteflow.core.NodeComponent.execute(NodeComponent.java:108) [liteflow-core-2.12.0.jar:2.12.0]
at com.yomahub.liteflow.flow.executor.NodeExecutor.execute(NodeExecutor.java:32) [liteflow-core-2.12.0.jar:2.12.0]
at com.yomahub.liteflow.flow.executor.DefaultNodeExecutor.execute(DefaultNodeExecutor.java:15) [liteflow-core-2.12.0.jar:2.12.0]
at com.yomahub.liteflow.flow.element.Node.execute(Node.java:154) [liteflow-core-2.12.0.jar:2.12.0]
at com.yomahub.liteflow.flow.element.condition.ThenCondition.executeCondition(ThenCondition.java:44) [liteflow-core-2.12.0.jar:2.12.0]
at com.yomahub.liteflow.flow.element.Condition.execute(Condition.java:57) [liteflow-core-2.12.0.jar:2.12.0]
at com.yomahub.liteflow.flow.element.Chain.execute(Chain.java:104) [liteflow-core-2.12.0.jar:2.12.0]
at com.yomahub.liteflow.core.FlowExecutor.doExecute(FlowExecutor.java:438) [liteflow-core-2.12.0.jar:2.12.0]
at com.yomahub.liteflow.core.FlowExecutor.execute2Resp(FlowExecutor.java:352) [liteflow-core-2.12.0.jar:2.12.0]
at com.yomahub.liteflow.core.FlowExecutor.execute2Resp(FlowExecutor.java:290) [liteflow-core-2.12.0.jar:2.12.0]
at cn.newalways.erp.saas.importer.liteflow.LiteFlowExecutor.lambda$runChain$1(LiteFlowExecutor.java:43) [classes/:na]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_382]
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) ~[na:1.8.0_382]
at java.util.concurrent.FutureTask.run(FutureTask.java) ~[na:1.8.0_382]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_382]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_382]
at java.lang.Thread.run(Thread.java:750) ~[na:1.8.0_382]

@lzx1026078111
Copy link

@huangzhb 开头提供的json和日志中的json不符。日志中对应的sqlserverreader,jdbcUrl是String类型,不是List。根据使用文档,jdbcUrl需要是List类型,所以报错。
"jdbcUrl":"jdbc:sqlserver://:1433;DatabaseName=dt_bjh"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants