hive报错 java.lang.NoClassDefFoundError: org/apache/hadoop/hive/conf/HiveConf

启动Hive时报错如下:

wamdm@WAMDM5:~/hive/build/dist/bin$ ./hive

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hive/conf/HiveConf

        at java.lang.Class.forName0(Native Method)

        at java.lang.Class.forName(Class.java:247)

        at org.apache.hadoop.util.RunJar.main(RunJar.java:149)

Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hive.conf.HiveConf

        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)

        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

解决方法:

export HBASE_HOME=/data/hbase
export HADOOP_CLASSPATH=$HBASE_HOME/lib/

hadoop-env.sh里面被增加了HADOOP_CLASSPATH的设置,如下:

export HADOOP_CLASSPATH=$HBASE_HOME/lib/

将其修改为:

export HBASE_HOME=/data/hbase
export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$HBASE_HOME/lib/

所以增加CLASSPATH时要记得把原来的也加上,而不是覆盖,否则会造成找不到路径。

你可能感兴趣的:(Hive)