Spacez Spacez - 10 months ago 79
Java Question

Error: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.HBaseConfiguration compiling using javac

I'm a beginner in Hadoop and MapReduce. After I installed Hadoop on my Ubuntu VM, I tried some starter examples like Wordcount and Anagram.

I would like to do an

Apriori on MapReduce
. I found this one on Sourceforge (

After I download and installed some required components such as
(though I have problems installing log4j so I chose to disable them by setting the level to off),

I struggle with the problem

"Error: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.HBaseConfiguration" -- as in the picture. (

It happens every time I would like to run the jar file.
The steps I take are

1. javac -cp "$HADOOP_HOME/share/hadoop/mapreduce/hadoop-common-2.0.0-alpha.jar:$HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduce-client-core-2.0.2-alpha.jar:$HADOOP_HOME/lib/commons-configuration-1.10/*:/usr/local/apache-log4j-1.2.17/log4j-1.2.17.jar:/usr/lib/hbase/hbase-0.94.8/hbase-0.94.8.jar"

2. jar -cvf apriori.jar -C . .

3. $HADOOP_HOME/bin/hadoop jar /home/hduser/yarn/hadoop-2.5.1/share/hadoop/mapreduce/apriori.jar apriori /in /out2 /out2c /out2a

(The problem happens after I enter the command in step 3)
There is no error shown after I compiled in step 1 (However, I have tried compiling while not including the
and there are around 100 errors -- so I guess the lib works well).

I stick with this problem for around 2 weeks :( and couldn't find any working solutions. I have tried many suggestion I found such as fixing the environment variables, add some lines in
, etc. Here are some that I bookmarked them (but didn't solve mine).

Thank you so much and really appreciated every help,


Answer Source

I have solved this by re-installing Hadoop and HBase with compatible versions (I'm using Hadoop 2.5.1 and HBase 0.98.11). Also, adding correct classpaths of the Hadoop and Hbase jars in the hadoop-env.