我正在使用Sqoop尝试将sql server表导入Hive。连接字符串正常工作但导入失败。以下是输出。如果我尝试导入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)
答案 0 :(得分:0)
上面显示的输出错误是由于hadoop jar不在CLASSPATH中。设置正确的CLASSPATH后尝试导入。以下是tcsh
shell的示例。
setenv CLASSPATH $HADOOP_HOME/lib/*:$CLASSPATH
答案 1 :(得分:0)
问题原来是我有一个名为“Text”的列名,这导致了错误。我通过重命名我的列来修复它。