连接到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。java:73)在org.apache.hadoop.io.retry.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。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(文件系统)。java:92)在org.apache.hadoop.fs.filesystem$cache.getinternal(文件系统)。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)
下面是我的代码:
***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();
}***
这里是hdfs-site.xml的一部分
...
<property>
<name>dfs.nameservices</name>
<value>mycluster</value>
<final>true</final>
</property>
....
<property>
<name>dfs.client.failover.proxy.provider.mycluster</name>
<value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
</property>
在core-site.xml中
<property>
<name>fs.defaultFS</name>
<value>hdfs://mycluster</value>
</property>
....
1条答案
按热度按时间shyt4zoc1#
我在尝试运行我的应用程序(在hortonworks中)时遇到了同样的问题。在被卡住之后-这花了一段时间,所以添加这里以供将来参考-下面修复了这个问题。
添加到pom.xml(注意:版本可能会有所不同,请相应设置):
或添加:
以使hadoop hdfs客户机jar在运行时包含在内。