使用sqoop java.io导入配置单元时出错

tvmytwxo  于 2021-05-29  发布在  Hadoop
关注(0)|答案(2)|浏览(354)

我正在使用sqoop尝试将sqlserver表导入配置单元。连接字符串工作正常,但导入失败。下面是输出。如果我尝试导入到hdfs中,也会遇到同样的错误。有人知道问题是什么吗?

[cloudera@ushydgnadipalvx sqoop]$ sqoop import --connect "jdbc:sqlserver://[server];username=[username];password=[password];database=[dbname]" --table [tablename] --hive-import
Warning: /usr/lib/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
15/07/10 15:31:41 INFO sqoop.Sqoop: Running Sqoop version: 1.4.3-cdh4.7.0
15/07/10 15:31:41 INFO tool.BaseSqoopTool: Using Hive-specific delimiters for output. You can override
15/07/10 15:31:41 INFO tool.BaseSqoopTool: delimiters with --fields-terminated-by, etc.
15/07/10 15:31:41 INFO manager.SqlManager: Using default fetchSize of 1000
15/07/10 15:31:41 INFO tool.CodeGenTool: Beginning code generation
15/07/10 15:31:43 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM [SocialDatas] AS t WHERE 1=0
15/07/10 15:31:45 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /usr/lib/hadoop-0.20-mapreduce
/tmp/sqoop-cloudera/compile/0159bb09ed314f098b249cb4c7c97130/SocialDatas.java:206: cannot find symbol
symbol  : method readString(java.io.DataInput)
location: class java.lang.String
    this.Language = Text.readString(__dataIn);
                        ^
/tmp/sqoop-cloudera/compile/0159bb09ed314f098b249cb4c7c97130/SocialDatas.java:211: cannot find symbol
symbol  : method readString(java.io.DataInput)
location: class java.lang.String
    this.Platform = Text.readString(__dataIn);
                        ^
/tmp/sqoop-cloudera/compile/0159bb09ed314f098b249cb4c7c97130/SocialDatas.java:216: cannot find symbol
symbol  : method readString(java.io.DataInput)
location: class java.lang.String
    this.Text = Text.readString(__dataIn);
                    ^
/tmp/sqoop-cloudera/compile/0159bb09ed314f098b249cb4c7c97130/SocialDatas.java:257: cannot find symbol
symbol  : method writeString(java.io.DataOutput,java.lang.String)
location: class java.lang.String
    Text.writeString(__dataOut, Language);
        ^
/tmp/sqoop-cloudera/compile/0159bb09ed314f098b249cb4c7c97130/SocialDatas.java:263: cannot find symbol
symbol  : method writeString(java.io.DataOutput,java.lang.String)
location: class java.lang.String
    Text.writeString(__dataOut, Platform);
        ^
/tmp/sqoop-cloudera/compile/0159bb09ed314f098b249cb4c7c97130/SocialDatas.java:269: cannot find symbol
symbol  : method writeString(java.io.DataOutput,java.lang.String)
location: class java.lang.String
    Text.writeString(__dataOut, Text);
        ^
Note: /tmp/sqoop-cloudera/compile/0159bb09ed314f098b249cb4c7c97130/SocialDatas.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
6 errors
15/07/10 15:31:47 ERROR tool.ImportTool: Encountered IOException running import job: java.io.IOException: Error returned by javac
    at org.apache.sqoop.orm.CompilationManager.compile(CompilationManager.java:217)
    at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:97)
    at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:396)
    at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:506)
    at org.apache.sqoop.Sqoop.run(Sqoop.java:147)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
    at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)
    at org.apache.sqoop.Sqoop.runTool(Sqoop.java:222)
    at org.apache.sqoop.Sqoop.runTool(Sqoop.java:231)
    at org.apache.sqoop.Sqoop.main(Sqoop.java:240)
yzuktlbb

yzuktlbb1#

上面显示的输出错误是由于hadoopjar不在类路径中造成的。设置正确的类路径后尝试导入。下面是一个例子 tcsh 贝壳。

setenv CLASSPATH $HADOOP_HOME/lib/*:$CLASSPATH
olqngx59

olqngx592#

问题是我有一个名为“text”的列名,这就是导致错误的原因。我通过重命名我的列来修复它。

相关问题