Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration

后端 未结 5 737
慢半拍i
慢半拍i 2020-12-05 22:11

I am using Hadoop 1.0.3 and HBase 0.94.22. I am trying to run a mapper program to read values from a Hbase table and output them to a file. I am getting the following error:

相关标签:
5条回答
  • 2020-12-05 22:30

    I tried editing the hadoop-env.sh file, but the changes mentioned here didn't work for me.

    What worked is this:

    export HADOOP_CLASSPATH="$HADOOP_CLASSPATH:$HBASE_HOME/lib/*"
    

    I just added that at the end of my hadoop-env.sh. Do not forget to set your HBASE_HOME variable. You can also replace the $HBASE_HOME with the actual path of your hbase installation.

    0 讨论(0)
  • 2020-12-05 22:41

    here CreateTable is my java class file

    use this command

    java -cp .:/home/hadoop/hbase/hbase-0.94.8/hbase-0.94.8.jar:/home/hadoop/hbase/hbase-0.94.8/lib/* CreateTable

    0 讨论(0)
  • 2020-12-05 22:42

    I got the fix to the problem, I had not added the hbase classpath in the hadoop-env.sh file. Below is the one I added to make the job work.

    $ export HADOOP_CLASSPATH=$HBASE_HOME/hbase-0.94.22.jar:\
        $HBASE_HOME/hbase-0.94.22-test.jar:\
        $HBASE_HOME/conf:\
        ${HBASE_HOME}/lib/zookeeper-3.4.5.jar:\
        ${HBASE_HOME}/lib/protobuf-java-2.4.0a.jar:\
        ${HBASE_HOME}/lib/guava-11.0.2.jar
    
    0 讨论(0)
  • 2020-12-05 22:45

    In case there is someone who has different paths/configuration. Here is what I added to hadoop-env.sh in order to make it work:

    $ export HADOOP_CLASSPATH="$HBASE_HOME/lib/hbase-client-0.98.11-hadoop2.jar:\
        $HBASE_HOME/lib/hbase-common-0.98.11-hadoop2.jar:\
        $HBASE_HOME/lib/protobuf-java-2.5.0.jar:\
        $HBASE_HOME/lib/guava-12.0.1.jar:\
        $HBASE_HOME/lib/zookeeper-3.4.6.jar:\
        $HBASE_HOME/lib/hbase-protocol-0.98.11-hadoop2.jar"
    

    NOTE: if you haven't set the $HBASE_HOME you have 2 choices. - By export HBASE_HOME=[your hbase installation path] - Or just replace the $HBASE_HOME with your hbase full path

    0 讨论(0)
  • 2020-12-05 22:46
    HADOOP_USER_CLASSPATH_FIRST=true \
    HADOOP_CLASSPATH=$($HBASE_HOME/bin/hbase mapredcp) \
    hadoop jar  /home/testdb.jar test 
    
    0 讨论(0)
提交回复
热议问题