无法连接hadoop

时间:2017-11-09 06:55:54

标签: java hadoop hdfs

连接到hadoop时,低于错误

线程中的异常" main" java.lang.AbstractMethodError:org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider.getProxy()Lorg / apache / hadoop / io / retry / FailoverProxyProvider $ ProxyInfo;     在org.apache.hadoop.io.retry.RetryInvocationHandler。(RetryInvocationHandler.java:73)     在org.apache.hadoop.io.retry.RetryInvocationHandler。(RetryInvocationHandler.java:64)     在org.apache.hadoop.io.retry.RetryProxy.create(RetryProxy.java:58)     在org.apache.hadoop.hdfs.NameNodeProxies.createProxy(NameNodeProxies.java:147)     在org.apache.hadoop.hdfs.DFSClient。(DFSClient.java:510)     在org.apache.hadoop.hdfs.DFSClient。(DFSClient.java:453)     在org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:136)     在org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2653)     在org.apache.hadoop.fs.FileSystem.access $ 200(FileSystem.java:92)     在org.apache.hadoop.fs.FileSystem $ Cache.getInternal(FileSystem.java:2687)     在org.apache.hadoop.fs.FileSystem $ Cache.get(FileSystem.java:2669)     在org.apache.hadoop.fs.FileSystem.get(FileSystem.java:371)     在org.apache.hadoop.fs.FileSystem.get(FileSystem.java:170)     在hrumen.HTest.main(HTest.java:26)

以下是我的代码:

viewpager

这里是hdfs-site.xml的一部分

ontouchevent

在core-site.xml中

***Path corepath = new Path("/var/tmp/hactive/core-site.xml");
        Path sitepath = new Path("/var/tmp/hactive/hdfs-site.xml");
        Path yarnpath = new Path("/var/tmp/hactive/yarn-site.xml");
        Path mapredpath = new Path("/var/tmp/hactive/mapred-site.xml");

        Configuration hconf = new Configuration();
        hconf.addResource(corepath);
        hconf.addResource(sitepath);
        hconf.addResource(yarnpath);
        hconf.addResource(mapredpath);

        try{
            DFSAdmin dfadmin = new DFSAdmin(hconf);
            dfadmin.report();

        }
        catch(Exception e){
            //System.out.println("[Exception]: "+e);
            e.printStackTrace();
        }***

...

1 个答案:

答案 0 :(得分:0)

尝试运行我的应用程序时(在Hortonworks中),我遇到了同样的问题。卡住之后-花费了一段时间,因此在此处添加以供将来参考-以下内容解决了该问题。

可以添加到 pom.xml 中(注意:版本可能有所不同,请进行相应设置):

<dependency>
   <groupId>org.apache.hadoop</groupId>
   <artifactId>hadoop-hdfs</artifactId>
   <version>2.8.1</version>
</dependency>

或添加:

/path/to/hadoop-hdfs-client-<version_number>.jar

添加到类路径,以便在运行时包含 hadoop-hdfs-client jar。