3
votes

I have downloaded latest stable release of Hive, when I start /usr/local/hive/bin/hive it gives me this error:

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:264)
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: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:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 3 more

Hadoop DFS is started and working, and I have changed /usr/local/hive/conf/hive-env.sh to export HADOOP_HOME.

Does anyone know what else can I do? Thanks.

3
This is because your classpath is not properly set. Could you please describe how you installed Hive?Mark Grover
I downloaded Hive from apache.rediris.es/hive/stable/hive-0.8.1.tar.gz Then moved to /usr/local and gave it 777 permissions. If I type "echo $CLASSPATH" in console, I get: /usr/local/hive/bin/:/usr/local/hive/lib/:/usr/local/hadoop/bin/ among other directories. Which variable or path is Hive expecting to find? Thanks.sergi123

3 Answers

1
votes

Apart from editing hive-env.sh, you also need to edit your bash_profile.

vim ~/.bash_profile

Add the following lines to your bash_profile

export HIVE_HOME=/usr/local/hive
export PATH=$PATH:$HIVE_HOME/bin

Save this file and then

source ~/.bash_profile

If this still doesnt work, please include your hive-env.sh file and hive-site.xml file. Also please tell me if you are using derby or mysql as metastore.

0
votes

Solved moving:

export HADOOP_CLASSPATH=/usr/local/hbase/hbase-0.94.1.jar:/usr/local/hbase/hbase-0.94.1-test.jar:/usr/local/hbase/conf:/usr/local/hbase/lib/zookeeper-3.4.3.jar:/usr/local/hive/lib/*.jar:/usr/local/hbase

From /usr/local/hadoop/conf/hadoop-env.sh to ~/.bashrc

Thanks for the help.

0
votes

if you are facing this issue in sqoop while hive-imports then you need to copy hive-common-3.1.2.jar (or whichever version of hive-common-x.x.x.jar) from the $HIVE_HOME/lib folder and paste it into the $SQOOP_HOME/lib folder and the error will be gone