Reputation: 7593
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!
Upvotes: 2
Views: 12392
Reputation: 151
Make sure that native files are newly build in the system .
Wrong:
[hduser@master sbin]$ hadoop fs -ls /
16/07/17 15:38:17 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 5 items drwxr-xr-x - hduser supergroup 0 2016-07-17 10:57 /cm
Correct
[hduser@master sbin]$ hadoop fs -ls /
Found 5 items
drwxr-xr-x - hduser supergroup 0 2016-07-17 10:57 /cm
in wrong configuration , follow below link to build it http://www.myiphoneadventure.com/hardware/hadoop-build-native-library
For Hadoop 2.7.2 on RHL 6 GLIBC_2.12 , you can use https://github.com/sterin501/SecureHadoop/tree/master/native
For Complete hadoop 2.7.2 setup : http://wccandlinux.blogspot.in/2016/07/how-to-configure-hadoop-with-kerberos.html
Upvotes: 0
Reputation: 75346
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).
Upvotes: 3