복붙노트

[HADOOP] java.lang.UnsupportedOperationException가 : FileSystem.get 동안 DistributedFileSystem 파일 시스템 구현에 의해 구현되지 않음 ()

HADOOP

java.lang.UnsupportedOperationException가 : FileSystem.get 동안 DistributedFileSystem 파일 시스템 구현에 의해 구현되지 않음 ()

코드 조각을 부착 찾아주세요. 내 로컬 파일 시스템에 HDFS에서 파일을 다운로드하려면이 코드를 사용하고 있습니다 -

    Configuration conf = new Configuration();

    FileSystem hdfsFileSystem = FileSystem.get(conf);

    Path local = new Path(destinationPath);
    Path hdfs = new Path(sourcePath);

    String fileName = hdfs.getName();

    if (hdfsFileSystem.exists(hdfs))
    {
        hdfsFileSystem.copyToLocalFile(false, hdfs, local, true);
        logger.info("File " + fileName + " copied to local machine on location: " + destinationPath);
    }
    else
    {
        logger.error("File " + fileName + " does not exist on HDFS on location: " + sourcePath);
    }

이것은 다음과 같은 출력을 제공합니다 실행 -

Exception in thread "main" java.lang.UnsupportedOperationException: Not implemented by the DistributedFileSystem FileSystem implementation
at org.apache.hadoop.fs.FileSystem.getScheme(FileSystem.java:217)
at org.apache.hadoop.fs.FileSystem.loadFileSystems(FileSystem.java:2624)
at org.apache.hadoop.fs.FileSystem.getFileSystemClass(FileSystem.java:2634)
at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2651)
at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:92)
at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2687)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2669)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:371)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:170)
at com.flipkart.ads.importer.HdfsToLocalImporter.importFile(HdfsToLocalImporter.java:35)
at com.flipkart.ads.importer.HdfsToLocalImporter.main(HdfsToLocalImporter.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

Process finished with exit code 1

나는 무엇을 놓치고?

해결법

  1. ==============================

    1.해결

    해결

    내 마음을 교차하지 않았다. 그것은 단지 불일치 문제였다. 하둡 코드와 하둡 - 공유지는 같은 병을 제공하고 나는 모두의 종속성을 포함했다.

  2. ==============================

    2.당신이 거기 하둡 코어 *****. 항아리를 참조 path.If 빌드를 확인, 그것을 제거합니다. 그것은 필요하지 않습니다. 즉, 문제를 해결할 수

    당신이 거기 하둡 코어 *****. 항아리를 참조 path.If 빌드를 확인, 그것을 제거합니다. 그것은 필요하지 않습니다. 즉, 문제를 해결할 수

  3. ==============================

    3.당신은 당신의 HDFS 서버쪽으로 구성 객체를 가리 키도록해야합니다. 사용하다  conf.set ( "fs.defaultFS", "HDFS : // urlhere : 8020");

    당신은 당신의 HDFS 서버쪽으로 구성 객체를 가리 키도록해야합니다. 사용하다  conf.set ( "fs.defaultFS", "HDFS : // urlhere : 8020");

  4. ==============================

    4.당신은 conf.addResources가 누락되었습니다. 당신은 구성 객체를 초기화하지만 여전히 비어 있습니다.

    당신은 conf.addResources가 누락되었습니다. 당신은 구성 객체를 초기화하지만 여전히 비어 있습니다.

    문서 여기를 확인

    편집하다: 이 시도:

    conf.addResource (새로운 경로 ( "<절대 파일 경로>"))

  5. from https://stackoverflow.com/questions/33015753/java-lang-unsupportedoperationexception-not-implemented-by-the-distributedfiles by cc-by-sa and MIT license