Java – HBase 0.94.4 on Hadoop 2.2.0

HBase 0.94.4 on Hadoop 2.2.0… here is a solution to the problem.

HBase 0.94.4 on Hadoop 2.2.0

I’m trying to set up Hbase 0.94 (distributed setup) on Hadoop 2. I recompiled HBase to support Hadoop 2 using the command mvn -Dhadoop.profile=2.0 -DskipTests install

I replaced all hadoop-*.jars in HBase/lib with their counterparts in Hadoop 2.2. Still can’t get HMaster running. The following error occurred

FATAL org.apache.hadoop.hbase.master.HMaster: HBase is having a problem with its Hadoop jars.  You may need to recompile HBase against     Hadoop version 2.2.0 or change your hadoop jars to start properly
java.lang.NoClassDefFoundError: org/apache/hadoop/hdfs/protocol/FSConstants$SafeModeAction
        at org.apache.hadoop.hbase.util.FSUtils.waitOnSafeMode(FSUtils.java:529)
        at org.apache.hadoop.hbase.master.MasterFileSystem.checkRootDir(MasterFileSystem.java:333)
        at org.apache.hadoop.hbase.master.MasterFileSystem.createInitialFileSystemLayout(MasterFileSystem.java:130)
        at org.apache.hadoop.hbase.master.MasterFileSystem.<init>(MasterFileSystem.java:115)
        at org.apache.hadoop.hbase.master.HMaster.finishInitialization(HMaster.java:514)
        at org.apache.hadoop.hbase.master.HMaster.run(HMaster.java:376)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hdfs.protocol.FSConstants$SafeModeAction
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        ... 7 more

How to solve it?

Solution

This has been addressed by using a clean build with Maven. The following command works

mvn clean package assembly:assembly -DskipTests -Dhadoop.profile=2.0

Related Problems and Solutions