Dataphin管道任务从Oracle抽取数据到MySQL,运行报错“DlinkTaskPluginCollector - java.sql.SQLException: 流已被关闭”、“java.lang.IndexOutOfBoundsException: Index: 12, Size: 12”

更新时间:

问题描述

Dataphin管道任务从Oracle抽取数据到MySQL,运行报错“DlinkTaskPluginCollector - java.sql.SQLException: 流已被关闭”、“java.lang.IndexOutOfBoundsException: Index: 12, Size: 12”。完整的日志信息如下:

2022-04-25 09:11:02.946 [0-0-0-reader] INFO  CommonRdbmsReader$Task - Get response ResultSet cost 2987 ms with Sql: [select OWNER,TABLE_NAME,COLUMN_NAME,DATA_TYPE,DATA_TYPE_MOD,DATA_TYPE_OWNER,DATA_LENGTH,DATA_PRECISION,DATA_SCALE,NULLABLE,COLUMN_ID,DEFAULT_LENGTH,DATA_DEFAULT,NUM_DISTINCT,LOW_VALUE,HIGH_VALUE,DENSITY,NUM_NULLS,NUM_BUCKETS,LAST_ANALYZED,SAMPLE_SIZE,CHARACTER_SET_NAME,CHAR_COL_DECL_LENGTH,GLOBAL_STATS,USER_STATS,AVG_COL_LEN,CHAR_LENGTH,CHAR_USED,V80_FMT_IMAGE,DATA_UPGRADED,HISTOGRAM from "OMLOPR".ALL_TAB_COLUMNS_VIEW ] jdbcUrl:[jdbc:oracle:thin:@//IP:PORT/nods].
2022-04-25 09:11:03.001 [0-0-0-reader] ERROR DlinkTaskPluginCollector 
 - java.sql.SQLException: 流已被关闭
 at oracle.jdbc.driver.LongAccessor.getBytesInternal(LongAccessor.java:156) ~[ojdbc6-11.2.0.3.jar:11.2.0.3.0]
 at oracle.jdbc.driver.LongAccessor.getBytes(LongAccessor.java:126) ~[ojdbc6-11.2.0.3.jar:11.2.0.3.0]
 at oracle.jdbc.driver.OracleResultSetImpl.getBytes(OracleResultSetImpl.java:722) ~[ojdbc6-11.2.0.3.jar:11.2.0.3.0]
 at com.alibaba.datax.plugin.rdbms.reader.CommonRdbmsReader$Task.processColumnValue(CommonRdbmsReader.java:410) [plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
 at com.alibaba.datax.plugin.rdbms.reader.CommonRdbmsReader$Task.buildRecord(CommonRdbmsReader.java:380) [plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
 at com.alibaba.datax.plugin.rdbms.reader.CommonRdbmsReader$Task.transportOneRecord(CommonRdbmsReader.java:268) [plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
 at com.alibaba.datax.plugin.rdbms.reader.CommonRdbmsReader$Task.startRead(CommonRdbmsReader.java:240) [plugin-rdbms-util-0.0.1-SNAPSHOT.jar:na]
 at com.alibaba.datax.plugin.reader.oraclereader.OracleReader$Task.startRead(OracleReader.java:123) [oraclereader-0.0.1-SNAPSHOT.jar:na]
 at com.alibaba.dt.dlink.core.trans.adaptor.engine.ReaderRunnerAdaptor.run(ReaderRunnerAdaptor.java:57) [dlink-engine-0.0.1-SNAPSHOT.jar:na]
 at java.lang.Thread.run(Thread.java:882) [na:1.8.0_152]
2022-04-25 09:11:03.005 [0-0-0-reader] ERROR DlinkTaskPluginCollector - 脏数据: 
{"exception":"流已被关闭","record":[{"byteSize":5,"index":0,"rawData":"MDSYS","type":"STRING"},{"byteSize":23,"index":1,"rawData":"SDO_COORD_OP_PARAM_VALS","type":"STRING"},{"byteSize":15,"index":2,"rawData":"PARAM_VALUE_XML","type":"STRING"},{"byteSize":7,"index":3,"rawData":"XMLTYPE","type":"STRING"},{"byteSize":0,"index":4,"rawData":"","type":"STRING"},{"byteSize":6,"index":5,"rawData":"PUBLIC","type":"STRING"},{"byteSize":4,"index":6,"rawData":"2000","type":"DOUBLE"},{"byteSize":0,"index":7,"type":"DOUBLE"},{"byteSize":0,"index":8,"type":"DOUBLE"},{"byteSize":1,"index":9,"rawData":"Y","type":"STRING"},{"byteSize":1,"index":10,"rawData":"7","type":"DOUBLE"},{"byteSize":1,"index":11,"rawData":"4","type":"DOUBLE"}],"type":"reader"}
2022-04-25 09:11:03.014 [0-0-0-writer] ERROR WriterRunner - Writer Runner Received Exceptions:
com.alibaba.dt.pipeline.plugin.center.exception.DataXException: Code:[DBUtilErrorCode-05], Description:[往您配置的写入表中写入数据时失败.].  - java.lang.IndexOutOfBoundsException: Index: 12, Size: 12
 at java.util.ArrayList.rangeCheck(ArrayList.java:657)
 at java.util.ArrayList.get(ArrayList.java:433)
 at com.alibaba.dt.dlink.core.trans.adaptor.BaseWriterStepAdaptor.columnMapping(BaseWriterStepAdaptor.java:113)
 at com.alibaba.dt.dlink.core.trans.adaptor.engine.RecordReceiverAdaptor.getFromReader(RecordReceiverAdaptor.java:179)
 at com.alibaba.datax.plugin.rdbms.writer.CommonRdbmsWriter$Task.startWriteWithConnection(CommonRdbmsWriter.java:322)
 at com.alibaba.datax.plugin.rdbms.writer.CommonRdbmsWriter$Task.startWrite(CommonRdbmsWriter.java:371)
 at com.alibaba.datax.plugin.writer.mysqlwriter.MysqlWriter$Task.startWrite(MysqlWriter.java:78)
 at com.alibaba.dt.dlink.core.trans.WriterRunner.run(WriterRunner.java:50)
 at java.lang.Thread.run(Thread.java:882)
 - java.lang.IndexOutOfBoundsException: Index: 12, Size: 12
 at java.util.ArrayList.rangeCheck(ArrayList.java:657)
 at java.util.ArrayList.get(ArrayList.java:433)
 at com.alibaba.dt.dlink.core.trans.adaptor.BaseWriterStepAdaptor.columnMapping(BaseWriterStepAdaptor.java:113)
 at com.alibaba.dt.dlink.core.trans.adaptor.engine.RecordReceiverAdaptor.getFromReader(RecordReceiverAdaptor.java:179)
 at com.alibaba.datax.plugin.rdbms.writer.CommonRdbmsWriter$Task.startWriteWithConnection(CommonRdbmsWriter.java:322)
 at com.alibaba.datax.plugin.rdbms.writer.CommonRdbmsWriter$Task.startWrite(CommonRdbmsWriter.java:371)
 at com.alibaba.datax.plugin.writer.mysqlwriter.MysqlWriter$Task.startWrite(MysqlWriter.java:78)
 at com.alibaba.dt.dlink.core.trans.WriterRunner.run(WriterRunner.java:50)
 at java.lang.Thread.run(Thread.java:882)

问题原因

在从Oracle数据库中读取数据的时候有时候会报“流已关闭”的异常,查询发现这是Oracle的一个bug,原因是表中有LONG数据类型的字段。
如果Oracle数据库表中有LONG类型的字段,在从结果集中读取数据的时候,如果Long类型的字段不在第一位,就会报“流已关闭”异常。

解决方案

建议修改表结构,可以将LONG类型的字段用别的类型来代替,如TEXT或者CLOB。

适用于

  • Dataphin