hadoop 线程"main" java.io.IOException 中的异常:没有 FileSystem for scheme: https



我在HDFS上执行此程序。

package abc;
import java.net.URI;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
public class mycls {
    public static void main(String[] args) throws Exception {
        FileSystem hdfs = FileSystem.get(URI.create("https://localhost:19000"), new Configuration());
        Path homeDir = hdfs.getHomeDirectory();
        System.out.println("Home Folder: " + homeDir);
        Path workingDir = hdfs.getWorkingDirectory();
        System.out.println("Working Folder: " + workingDir);
    }
}

但我一直遇到此错误。

Exception in thread "main" java.io.IOException: No FileSystem for scheme: https
    at org.apache.hadoop.fs.FileSystem.getFileSystemClass(FileSystem.java:2660)
    at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2667)
    at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:94)
    at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2703)
    at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2685)
    at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:373)
    at abc.mycls.main(mycls.java:11)

我添加了所有JAR文件以在Eclipse上访问Hadoop。我正在Windows 10,Hadoop-2.7.4和JDK-1.8工作。

它已解决。这是我的错误。使用create("hdfs://localhost:19000")代替create("https://localhost:19000")

最新更新