Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

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

avatar
Guru

Hi,

I am trying to access a HBase-backed Hive table via 'select * from tbl_name', but seems like some HBase jar's are not in place.

Any help highly appreciated 😉

Details:

0: jdbc:hive2://deala.corp:1> select * from tbl_name; Error: java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration (state=,code=0)

Regards, Gerd

PS: HDP2.2.4.2, Ambari 2.1.2

1 ACCEPTED SOLUTION

avatar

Append HBASE_CLASSPATH to HADOOP_CLASSPATH like below:-

export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$HBASE_CLASSPATH

//but before that confirm HBASE_CLASSPATH is properly set.

And

also you may need to set hive.aux.jars.path in hive-site.xml so that libraries are available in MR job.

<property> <name>hive.aux.jars.path</name> <value><hive_home>/lib/hive-hbase-handler-<version>.jar, <hbase_home>/lib/hbase-client-<version>.jar, <hbase_home>/lib/hbase-server-<version>.jar,<hbase_home>/lib/hbase-protocol-<version>.jar,<hbase_home>/lib/zookeeper-<version>.jar</value> <description>A comma separated list (with no spaces) of the jar files required for Hive-HBase integration</description> </property>

replace the above paths with actual paths as per your setup.

View solution in original post

3 REPLIES 3

avatar

Append HBASE_CLASSPATH to HADOOP_CLASSPATH like below:-

export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$HBASE_CLASSPATH

//but before that confirm HBASE_CLASSPATH is properly set.

And

also you may need to set hive.aux.jars.path in hive-site.xml so that libraries are available in MR job.

<property> <name>hive.aux.jars.path</name> <value><hive_home>/lib/hive-hbase-handler-<version>.jar, <hbase_home>/lib/hbase-client-<version>.jar, <hbase_home>/lib/hbase-server-<version>.jar,<hbase_home>/lib/hbase-protocol-<version>.jar,<hbase_home>/lib/zookeeper-<version>.jar</value> <description>A comma separated list (with no spaces) of the jar files required for Hive-HBase integration</description> </property>

replace the above paths with actual paths as per your setup.

avatar
Guru

Hi,

just to extend @asinghal 's answer, the whole solution was:

1) adding

export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$HBASE_CLASSPATH 

to hadoop-env section in Ambari=>HDFS=>config

2) restart HDFS (will be shown in Ambari to restart all affected services)

3) restart Hive (this won't show up in Ambari, but needs to be restarted to apply the change from steps 1. and 2.)

Regards....

avatar

Thanks @Gerd Koenig for extending the answer in terms of ambari and HDP.