简体   繁体   English

错字“ hdfs”给我:“ java.io.IOException:方案:hdfs没有文件系统”。 在hadoop 2.7.7上使用FileSystem lib

[英]Typo in word “hdfs” gives me: “java.io.IOException: No FileSystem for scheme: hdfs”. Using FileSystem lib over hadoop 2.7.7

While using FileSystem.get(URI.create("hdfs://localhost:9000/"), configuration) I'm getting the error "Typo in word hdfs", when I tried to run the code gives me the IOException: 在使用FileSystem.get(URI.create("hdfs://localhost:9000/"), configuration)时,当我尝试运行代码时,出现错误“输入hdfs中的错字”,给我IOException:

    java.io.IOException: No FileSystem for scheme: hdfs
at org.apache.hadoop.fs.FileSystem.getFileSystemClass(FileSystem.java:2658)
at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2665)
at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:93)
at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2701)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2683)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:372)
at com.oracle.hadoop.client.Test.main(Test.java:53)

I already tried to use in different ways to use the call to hdfs, I'm using the libraries for hadoop 2.7.7 我已经尝试过以不同的方式使用对hdfs的调用,我正在使用hadoop 2.7.7的库。

Here is my current code: 这是我当前的代码:

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.*;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IOUtils;
import org.apache.log4j.BasicConfigurator;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;

public class Test {

 public static void main(String []args) {
    Configuration conf = new Configuration();
    InputStream in = null;

    try {
        FileSystem fs = FileSystem.get(URI.create("hdfs://localhost:9000/"), conf);
        in = fs.open(new Path(uri));
        IOUtils.copyBytes(in, System.out, 4096, false);
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        IOUtils.closeStream(in);
    }  
   }

实际上,我只是添加了这个Maven依赖项: http://mvnrepository.com/artifact/org.apache.hadoop/hadoop-hdfs/2.7.7 : http://mvnrepository.com/artifact/org.apache.hadoop/hadoop-hdfs/2.7.7到maven pom.xml并已解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 R 2.15.1; 拉普0.73; CDH 5-java.io.IOException:方案:hdfs没有文件系统 - R 2.15.1; Rhipe 0.73; CDH 5 - java.io.IOException: No FileSystem for scheme: hdfs hadoop线程“主”中的异常java.io.IOException:方案的文件系统没有:https - hadoop Exception in thread “main” java.io.IOException: No FileSystem for scheme: https 在方案中没有用于方案:hdfs的文件系统 - No FileSystem for scheme: hdfs, in Java Program Py4JJavaError: java.io.IOException: No FileSystem for scheme: C - Py4JJavaError: java.io.IOException: No FileSystem for scheme: C java.io.IOException:方案没有文件系统:spark java 中的 adls-gen 2 的 abfs - java.io.IOException: No FileSystem for scheme: abfs for adls-gen 2 in spark java 无法保存到 S3,出现错误“java.io.IOException: No FileSystem for scheme:s3a” - Failed to Save to S3 with error “java.io.IOException: No FileSystem for scheme: s3a” camel-hdfs2没有用于方案的文件系统:hdfs - camel-hdfs2 No FileSystem for scheme: hdfs 方案没有文件系统:找不到 hdfs 和类 org.apache.hadoop.DistributedFileSystem - No FileSystem for scheme:hdfs and Class org.apache.hadoop.DistributedFileSystem not found 关于hadoop HDFS文件系统重命名 - About hadoop hdfs filesystem rename java.io.IOException:不完整的HDFS URI,没有主机 - java.io.IOException: Incomplete HDFS URI, no host
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM