2

I installed hadoop-2.7.1 and hive-2.0.1.

Here is my directory structure:

~/hadoop-2.7.1/ # hadoop directory
~/hadoop-2.7.1/hive/apache-hive-2.0.1-bin # hive directory

My problem is that when I starting ./hive in ~/hadoop-2.7.1/hive/apache-hive-2.0.1-bin/bin/, this error occurs:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hive/conf/HiveVariableSource
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.apache.hadoop.util.RunJar.run(RunJar.java:214)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hive.conf.HiveVariableSource
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 4 more

I just downloaded apache-hive-2.0.1-bin.tar.gz and unzip it. There is no any other configuration I did.

I'm using amazon ec2(ubuntu) and all of the hadoop nodes are started well.

Edit

Here is my hadoop-env.sh

...(omitted)...
export HADOOP_PID_DIR=${HADOOP_PID_DIR}
export HADOOP_SECURE_DN_PID_DIR=${HADOOP_PID_DIR}

# A string representing this instance of hadoop. $USER by default.
export HADOOP_IDENT_STRING=$USER

export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export PATH=${JAVA_HOME}/bin:${PATH}
export HADOOP_CLASSPATH=${JAVA_HOME}/lib/tools.jar:${HADOOP_CLASSPATH}
halfer
  • 19,824
  • 17
  • 99
  • 186
yakkisyou
  • 510
  • 7
  • 14
  • Your classpath might not have been set properly. Could you please try adding it to your PATH and echo PATH and HADOOP_CLASSPATH. – Makubex May 31 '16 at 12:12
  • @Makubex I am starting hive in the `[hive-path]/bin`. however Should I set the path? – yakkisyou May 31 '16 at 12:14
  • That should be fine. But i jus wanted to see what is in your classpath. Also update your HADOOP_CLASSPATH in hadoop-env.sh to export HADOOP_CLASSPATH=${JAVA_HOME}/lib/tools.jar:${HADOOP_CLASSPATH} – Makubex May 31 '16 at 12:39
  • 1
    @Makubex Thank you so muuch! I just resolved this question! after `source hadoop-env.sh`, I follow this steps: http://stackoverflow.com/a/36631358/6388746 – yakkisyou May 31 '16 at 12:39

1 Answers1

1

I had a similar problem but with different issue.

I needed to remove HADOOP_* definitions from hadoop-env.sh.

In my configuration, I don't have them in .bashrc but I put them into a file in /etc/profile.d/

I found the solution here: http://sedeks.blogspot.com/2013/02/apache-hive-error-resolution.html

Lorenzo Eccher
  • 301
  • 2
  • 4