软件运行环境:redhat 6
hadoop-2.6.0-cdh5.9.0
hive-1.1.0-cdh5.9.0
sqoop-1.4.6-cdh5.9.0
hive在主节点,sqoop在从节点上
sqoop导入hive表示报错
16/12/09 17:18:47 INFO mapreduce.ImportJobBase: Transferred 49 bytes in 19.624 seconds (2.4969 bytes/sec) 16/12/09 17:18:47 INFO mapreduce.ImportJobBase: Retrieved 6 records. 16/12/09 17:18:47 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `sss` AS t LIMIT 1 16/12/09 17:18:47 INFO hive.HiveImport: Loading uploaded data into Hive 16/12/09 17:18:47 ERROR hive.HiveConfig: Could not load org.apache.hadoop.hive.conf.HiveConf. Make sure HIVE_CONF_DIR is set correctly. 16/12/09 17:18:47 ERROR tool.ImportTool: Encountered IOException running import job: 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:524) at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:615) at org.apache.sqoop.Sqoop.run(Sqoop.java:143) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179) at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218) at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227) at org.apache.sqoop.Sqoop.main(Sqoop.java:236) Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hive.conf.HiveConf at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:190) at org.apache.sqoop.hive.HiveConfig.getHiveConf(HiveConfig.java:44) ... 12 more
网上说的环境变量的问题也配置了,还有什么问题可以去检查
export HIVE_HOME=/home/hadoop/hive-1.1.0-cdh5.9.0 export HADOOP_HOME=/home/hadoop/hadoop-2.6.0-cdh5.9.0 export HIVE_CONF_DIR=/home/hadoop/hive-1.1.0-cdh5.9.0/conf export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$HIVE_HOME/lib/*
定义用户变量 不是系统变量 (用户目录下)
sudovim~/.bash_profile
exportHADOOP_CLASSPATH=$HADOOP_CLASSPATH:/cloud/hive-1.1.0-cdh5.10.0/lib/*
source~/.bash_profile
sqoop导入hive表报错Couldnotloadorg.apache.hadoop.hive.conf.HiveConf.MakesureHIVE_CONF_DIRissetcorrectly
方法1:
往~/.bash_profile里新加一行
exportHADOOP_CLASSPATH=$HADOOP_CLASSPATH:$HIVE_HOME/lib/*
然后,source~/.bash_profile
cphive/lib/hive-common-3.0.0.jarsqoop/lib/
@yangchangjiang的答案有用,可惜积分不够顶不上去。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。