zoukankan      html  css  js  c++  java
  • hadoop程序问题:java.lang.IllegalArgumentException: Wrong FS: hdfs:/ expected file:///

    Java代码如下:

    1. FileSystem fs = FileSystem.get(conf); 
    2. in = fs.open(new Path("hdfs://192.168.130.54:19000/user/hmail/output/part-00000")); 

    抛出异常如下:

    1. Exception in thread "main" java.lang.IllegalArgumentException: Wrong FS: hdfs://192.168.130.54:19000/user/hmail/output/part-00000, expected: file:/// 
    2.     at org.apache.hadoop.fs.FileSystem.checkPath(FileSystem.java:310) 
    3.     at org.apache.hadoop.fs.RawLocalFileSystem.pathToFile(RawLocalFileSystem.java:47) 
    4.     at org.apache.hadoop.fs.RawLocalFileSystem.getFileStatus(RawLocalFileSystem.java:357) 
    5.     at org.apache.hadoop.fs.FilterFileSystem.getFileStatus(FilterFileSystem.java:245) 
    6.     at org.apache.hadoop.fs.ChecksumFileSystem$ChecksumFSInputChecker.<init>(ChecksumFileSystem.java:125) 
    7.     at org.apache.hadoop.fs.ChecksumFileSystem.open(ChecksumFileSystem.java:283) 
    8.     at org.apache.hadoop.fs.FileSystem.open(FileSystem.java:356) 
    9.     at com.netease.hadoop.HDFSCatWithAPI.main(HDFSCatWithAPI.java:23) 

    解决方案:

    hadoop需要把集群上的core-site.xml和hdfs-site.xml放到当前工程下。eclipse工作目录的bin文件夹下面


    因为是访问远程的HDFS 需要通过URI来获得FileSystem.

  • 相关阅读:
    Nginx源码编译安装
    nginx版本对比
    k8s中subpath挂载单个文件报错处理
    C++ array 数组函数
    洛谷 P2141
    c++ set容器
    字符串中输出每一个元素的方法
    string中的pop_back()函数
    如何去掉前导0 在字符串中 算法
    pat 乙级1074
  • 原文地址:https://www.cnblogs.com/zhengrunjian/p/4650525.html
Copyright © 2011-2022 走看看