我试图运行相同的代码(org.apache.hadoop.hbase.mapreduce.Export)通过将所有所需的jar从java命令行路径(./java -cp ")添加到类路径导出类。:/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"
谁来帮帮我
add hadoop-mapreduce-client-jobclient.jar(下载前选择hadoop版本).
按@mentya说的解决了
如果你正在使用Maven,你也可以把它添加到你的pom.xml。
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-jobclient</artifactId>
<version>${hadoop.version}</version>
<scope>provided</scope>
</dependency>