问题描述
我试图运行MapReduce作业来扫描HBase表。目前我正在使用Cloudera 4.4附带的HBase版本0.94.6。在我的程序中的某个地方,我使用了Scan(),并且正确地导入它:
import org.apache.hadoop。 hbase.client.Scan;
它编译得很好,我也可以创建一个jar文件。我通过将 hbase classpath
作为-cp选项的值来传递。在运行程序时,我得到以下消息:
线程main中的异常java.lang.NoClassDefFoundError:org / apache / hadoop / hbase / client / Scan
我使用以下代码运行代码:
hadoop jar my_program.jar MyJobClass -libjars< list_of_jars>
其中list_of_jars包含/opt/cloudera/parcels/CDH/lib/hbase/hbase.jar。为了仔细检查,我确认了hbase.jar包含Scan。我这样做:
jar tf /opt/cloudera/parcels/CDH/lib/hbase/hbase.jar
我可以看到这行:
org / apache / hadoop / hbase / client / Scan.class
in输出。所有看起来都对我好。我不明白为什么说扫描没有定义。我传递了正确的jar文件,它包含了这个类。
任何帮助都是值得赞赏的。
$ b $ $ p $ `
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.
Setting the HADOOP_CLASSPATH variable fixed the issue:
export HADOOP_CLASSPATH=`/usr/bin/hbase classpath`
这篇关于HBase扫描的java.lang.NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!