使用Sqoop工具把mysql的表往Hive import的时候发生的错误解决

执行的语句:
sqoop import --connect jdbc:mysql://master:3306/company --username root --password Omputer123? --table employee --delete-target-dir --num-mappers 1 --hive-import --fields-terminated-by "\t" --hive-overwrite --hive-table emp_hive

发生如下错误:

18/05/29 05:50:55 ERROR hive.HiveConfig: Could not load org.apache.hadoop.hive.conf.HiveConf. Make sure HIVE_CONF_DIR is set correctly.
18/05/29 05:50:55 ERROR tool.ImportTool: Import failed: java.io.IOException: java.lang.ClassNotFoundException: org.apache.hadoop.hive.conf.HiveConf
at org.apache.sqoop.hive.HiveConfig.getHiveConf(HiveConfig.java:50)
at org.apache.sqoop.hive.HiveImport.getHiveArgs(HiveImport.java:392)
at org.apache.sqoop.hive.HiveImport.executeExternalHiveScript(HiveImport.java:379)
at org.apache.sqoop.hive.HiveImport.executeScript(HiveImport.java:337)
at org.apache.sqoop.hive.HiveImport.importTable(HiveImport.java:241)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:537)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:628)
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:234)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:243)
at org.apache.sqoop.Sqoop.main(Sqoop.java:252)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hive.conf.HiveConf
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.apache.sqoop.hive.HiveConfig.getHiveConf(HiveConfig.java:44)
... 12 more

解决方法:在$SQOOP_HOME/lib目录执行:
ln -s /usr/local/hive2.2/lib/hive-exec-2.1.1.jar hive-exec-2.1.1.jar

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31360515/viewspace-2155297/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/31360515/viewspace-2155297/

你可能感兴趣的:(使用Sqoop工具把mysql的表往Hive import的时候发生的错误解决)