java.lang.NoClassDefFoundError with HBase Scan

被刻印的时光 ゝ 提交于 2019-12-10 18:29:47

问题


I am trying to run a MapReduce job to scan a HBase table. Currently I am using the version 0.94.6 of HBase that comes with Cloudera 4.4. At some point in my program I use Scan(), and I properly import it with:

import org.apache.hadoop.hbase.client.Scan;

It compiles well and I am able to create a jar file too. I do it by passing the hbase classpath as the value for the -cp option. When running the program, I obtain the following message:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/client/Scan

I run the code using:

hadoop jar my_program.jar MyJobClass -libjars <list_of_jars>

where list_of_jars contains /opt/cloudera/parcels/CDH/lib/hbase/hbase.jar. Just to double-check, I confirmed that hbase.jar contains Scan. I do it with:

jar tf /opt/cloudera/parcels/CDH/lib/hbase/hbase.jar

And I can see the line:

org/apache/hadoop/hbase/client/Scan.class

in the output. All looks ok to me. I don't understand why is saying that Scan is not defined. I pass the correct jar, and it contains the class.

Any help is appreciated.


回答1:


Setting the HADOOP_CLASSPATH variable fixed the issue:

export HADOOP_CLASSPATH=`/usr/bin/hbase classpath`


来源:https://stackoverflow.com/questions/19577680/java-lang-noclassdeffounderror-with-hbase-scan

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!