我试图通过从java命令行路径(./java -cp“添加所有必需的jar到类路径)来运行相同的代码(org.apache.hadoop.hbase.mapreduce.Export)导出类。 :/ npachava / *“导出测试/测试”,我收到以下错误。
Exception in thread "main" java.io.IOException: Cannot initialize Cluster. Please check your configuration for mapreduce.framework.name and the correspond server addresses.
at org.apache.hadoop.mapreduce.Cluster.initialize(Cluster.java:120)
at org.apache.hadoop.mapreduce.Cluster.<init>(Cluster.java:82)
at org.apache.hadoop.mapreduce.Cluster.<init>(Cluster.java:75)
at org.apache.hadoop.mapreduce.Job$9.run(Job.java:1260)
at org.apache.hadoop.mapreduce.Job$9.run(Job.java:1256)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
at org.apache.hadoop.mapreduce.Job.connect(Job.java:1256)
at org.apache.hadoop.mapreduce.Job.submit(Job.java:1284)
at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1308)
at Export.main(Export.java:194)
但是从hbase bin目录(./hbase org.apache.hadoop.hbase.mapreduce.Driver export test / TestTableData)的命令提示符运行完全正常。
我试图将配置设置为yarn / local但两者都没有用
Configuration conf = HBaseConfiguration.create();
conf.set("mapreduce.framework.name", "yarn"); also with "local"
任何人都请帮忙
我在linux上运行hbase 0.94.17版本。
答案 0 :(得分:10)
添加hadoop-mapreduce-client-jobclient.jar(下载前选择hadoop版本)。
答案 1 :(得分:6)
解决@mentya说。
如果您使用的是Maven,您也可以将其添加到 pom.xml 。
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-jobclient</artifactId>
<version>${hadoop.version}</version>
<scope>provided</scope>
</dependency>