<legend id='QN1uc'><style id='QN1uc'><dir id='QN1uc'><q id='QN1uc'></q></dir></style></legend>
    <i id='QN1uc'><tr id='QN1uc'><dt id='QN1uc'><q id='QN1uc'><span id='QN1uc'><b id='QN1uc'><form id='QN1uc'><ins id='QN1uc'></ins><ul id='QN1uc'></ul><sub id='QN1uc'></sub></form><legend id='QN1uc'></legend><bdo id='QN1uc'><pre id='QN1uc'><center id='QN1uc'></center></pre></bdo></b><th id='QN1uc'></th></span></q></dt></tr></i><div id='QN1uc'><tfoot id='QN1uc'></tfoot><dl id='QN1uc'><fieldset id='QN1uc'></fieldset></dl></div>

    1. <small id='QN1uc'></small><noframes id='QN1uc'>

        <bdo id='QN1uc'></bdo><ul id='QN1uc'></ul>
      <tfoot id='QN1uc'></tfoot>
    2. Hadoop 2.6.0 浏览文件系统 Java

      时间:2023-09-27

        <tbody id='cDLYw'></tbody>
      <tfoot id='cDLYw'></tfoot>
      <legend id='cDLYw'><style id='cDLYw'><dir id='cDLYw'><q id='cDLYw'></q></dir></style></legend>

            <small id='cDLYw'></small><noframes id='cDLYw'>

              <bdo id='cDLYw'></bdo><ul id='cDLYw'></ul>
              • <i id='cDLYw'><tr id='cDLYw'><dt id='cDLYw'><q id='cDLYw'><span id='cDLYw'><b id='cDLYw'><form id='cDLYw'><ins id='cDLYw'></ins><ul id='cDLYw'></ul><sub id='cDLYw'></sub></form><legend id='cDLYw'></legend><bdo id='cDLYw'><pre id='cDLYw'><center id='cDLYw'></center></pre></bdo></b><th id='cDLYw'></th></span></q></dt></tr></i><div id='cDLYw'><tfoot id='cDLYw'></tfoot><dl id='cDLYw'><fieldset id='cDLYw'></fieldset></dl></div>

                本文介绍了Hadoop 2.6.0 浏览文件系统 Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我在 CentOS 6.6 上安装了一个基本的 hadoop 集群,并想编写一些基本程序(浏览文件系统、删除/添加文件等),但我什至连最基本的应用程序都无法正常工作.

                I have installed a basic hadoop cluster on CentOS 6.6 and want to write a few basic programs (browse the filesystem, delete/add files, etc) but I'm struggling to get even the most basic app working.

                在运行一些基本代码以将目录的内容列出到控制台时,我收到以下错误:

                When running some basic code to list the contents of a directory to the console I get the following error:

                Exception in thread "main" java.lang.NoSuchMethodError: org.apache.hadoop.ipc.RPC.getProxy(Ljava/lang/Class;JLjava/net/InetSocketAddress;Lorg/apache/hadoop/security/UserGroupInformation;Lorg/apache/hadoop/conf/Configuration;Ljavax/net/SocketFactory;ILorg/apache/hadoop/io/retry/RetryPolicy;Z)Lorg/apache/hadoop/ipc/VersionedProtocol;
                    at org.apache.hadoop.hdfs.DFSClient.createRPCNamenode(DFSClient.java:135)
                    at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:280)
                    at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:245)
                    at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:100)
                    at mapreducetest.MapreduceTest.App.main(App.java:36)
                

                我的 pom.xml 依赖项

                My pom.xml dependencies

                          <dependencies>    
                            <dependency>                                                                                                                                       
                                <groupId>org.apache.hadoop</groupId>                                                                                                           
                                <artifactId>hadoop-common</artifactId>                                                                                                         
                                <version>2.6.0</version>                                                                                            
                            </dependency>  
                
                            <dependency>
                              <groupId>org.apache.hadoop</groupId>
                              <artifactId>hadoop-core</artifactId>
                              <version>1.2.1</version>
                            </dependency>       
                          </dependencies>
                

                代码:

                import java.io.IOException;
                import java.net.URI;
                import java.net.URISyntaxException;
                
                import org.apache.hadoop.conf.Configuration;
                import org.apache.hadoop.fs.FileStatus;
                import org.apache.hadoop.fs.FileSystem;
                import org.apache.hadoop.fs.Path;
                import org.apache.hadoop.hdfs.DistributedFileSystem;
                
                public class App 
                {   
                    public static void main( String[] args ) throws IOException, URISyntaxException
                    {
                
                
                        Configuration conf = new Configuration();
                        FileSystem fs = new DistributedFileSystem();
                        fs.initialize(new URI("hdfs://localhost:9000/"), conf);
                
                
                        for (FileStatus f :fs.listStatus(new Path("/")))
                        {
                            System.out.println(f.getPath().getName());                  
                        }
                
                        fs.close();
                
                    }
                }
                

                调用 fs.initialize() 后抛出错误.我真的不确定这里有什么问题.我是否缺少依赖项?他们是错误的版本吗?

                The error is being thrown after calling fs.initialize(). I'm really not sure what the issue is here. Am I missing dependencies? Are they the wrong version?

                推荐答案

                我通过调用java -jar app.jar .... etc"来运行它我应该一直在使用hadoop jar app.jar".

                I was running this by calling "java -jar app.jar .... etc" I should have been using "hadoop jar app.jar".

                当我正确运行它时按预期工作.

                Worked as intended when I ran it correctly.

                这篇关于Hadoop 2.6.0 浏览文件系统 Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:java.lang.UnsatisfiedLinkError: 没有 GurobiJni/Tomcat 下一篇:内存屏障和 TLB

                相关文章

                最新文章

                <i id='xjEPM'><tr id='xjEPM'><dt id='xjEPM'><q id='xjEPM'><span id='xjEPM'><b id='xjEPM'><form id='xjEPM'><ins id='xjEPM'></ins><ul id='xjEPM'></ul><sub id='xjEPM'></sub></form><legend id='xjEPM'></legend><bdo id='xjEPM'><pre id='xjEPM'><center id='xjEPM'></center></pre></bdo></b><th id='xjEPM'></th></span></q></dt></tr></i><div id='xjEPM'><tfoot id='xjEPM'></tfoot><dl id='xjEPM'><fieldset id='xjEPM'></fieldset></dl></div>
                1. <legend id='xjEPM'><style id='xjEPM'><dir id='xjEPM'><q id='xjEPM'></q></dir></style></legend>

                    <small id='xjEPM'></small><noframes id='xjEPM'>

                      <bdo id='xjEPM'></bdo><ul id='xjEPM'></ul>
                    <tfoot id='xjEPM'></tfoot>