Search code examples
javahbase

java.lang.NoClassDefFoundError: org/apache/htrace/core/HTraceConfiguration


I am using hadoop 2.9.1 and hbase 2.1.0 at stand-alone local mode.

When I tried staring HBase 2.1.0 using sudo start-hbase.sh at bin folder, I got below error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/htrace/core/HTraceConfiguration
    at org.apache.hadoop.hbase.master.HMasterCommandLine.startMaster(HMasterCommandLine.java:153)
    at org.apache.hadoop.hbase.master.HMasterCommandLine.run(HMasterCommandLine.java:140)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
    at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(ServerCommandLine.java:149)
    at org.apache.hadoop.hbase.master.HMaster.main(HMaster.java:2983)
Caused by: java.lang.ClassNotFoundException: org.apache.htrace.core.HTraceConfiguration
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)

This is my hbase-site.xml

<configuration>
    <property>
        <name>hbase.rootdir</name>
        <value>/home/niyazmohamed/bigdata/upgraded_versions/hbase-2.1.0/hbasedir</value>
    </property>

    <property>
        <name>hbase.zookeeper.quorum</name>
        <value>localhost</value>
    </property>

    <property>
        <name>dfs.replication</name>
        <value>1</value>
    </property>

    <property>
        <name>hbase.zookeeper.property.clientPort</name>
        <value>2181</value>
    </property>

    <property>
        <name>hbase.zookeeper.property.dataDir</name>
        <value>/home/niyazmohamed/bigdata/upgraded_versions/hbase-2.1.0/zookeeper</value>
    </property>

</configuration>

When I tried to start HBase version 1.2.0 , it started successfully and hbase shell was also accessible and CRUD operations were successful.

Hadoop and HBase path are set. Only by that , I was able to run HBase-1.2.0.

Only with HBase-2.1.0, this problem occurs.

Any help appreciated! Thanks in advance!


Solution

  • Related: Starting HBASE, java.lang.ClassNotFoundException: org.apache.htrace.SamplerBuilder

    htrace-core-*-incubating.jar was missing from some early versions of HBase 2.x

    If the htrace-core jar is in $HBASE_HOME/lib/client-facing-thirdparty

    copy the jar to $HBASE_HOME/lib, otherwise

    Download the Jar from Maven here

    and place into $HBASE_HOME/lib

    You can see in HBase pom.xml for version hbase 2.1 that htrace 4.2.0 is the correct version of the dependency. https://github.com/apache/hbase/blob/rel/2.1.0/pom.xml#L1364

    Goodluck.