java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/MasterNotRunningException

11,717

The class org.apache.hadoop.hbase.MasterNotRunning is not available on the classpath. You most likely have not set up the classpath to include the hadoop jar. This can be as simple as a misspelling (and $HOME must be expanded).

Share:
11,717
knt
Author by

knt

Updated on June 05, 2022

Comments

  • knt
    knt almost 2 years

    I created by own HBase java client code, but I am having a really difficult time compiling it and getting it to run. I am compiling from the command line, and I havent been able to find any instructions how to do this, or what jars I need to have on my classpath.

    Below is the classpath I'm using:

    $HADOOP_HOME/hadoop/hadoop-0.20.2/hadoop-0.20.2-core.jar:
    $HADOOP_HOME/hbase/hbase-0.90.0/hbase-0.90.0.jar:
    $HADOOP_HOME/hbase/lib/zookeeper-3.3.2.jar
    

    When I run the javac command, it compiles fine. However, when I run my java code, I get the below error:

    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/MasterNotRunningException
    Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.MasterNotRunningException
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    Could not find the main class: HBaseConnection.  Program will exit.  
    

    What am I missing?

    Thanks!

  • knt
    knt about 13 years
    Thanks. Yes, I did pass the correct classpath to the javac command, but since these Hadoop files are not on my global classpath, I was getting the error when I ran the java client using the java command. Passing in the classpath using "java -classpath $MYCLASSPATH HBaseConnection" did the trick.