zoukankan      html  css  js  c++  java
  • No FileSystem for scheme: hdfs问题

    通过FileSystem.get(conf)初始化的时候,要通过静态加载来实现,其加载类的方法代码如下:

    private static FileSystem createFileSystem(URI uri, Configuration conf
          ) throws IOException {
        Class<?> clazz = conf.getClass("fs." + uri.getScheme() + ".impl", null); 
        if (clazz == null) {
          throw new IOException("No FileSystem for scheme: " + uri.getScheme());
        }
        FileSystem fs = (FileSystem)ReflectionUtils.newInstance(clazz, conf);
        fs.initialize(uri, conf);
        return fs;
      }

    onf.getClass需要读取hadoop-common-x.jar下面的core-default.xml,但是这个xml里面没有fs.hdfs.impl的配置信息,所以需要将这个类给配置上去。

    将hadoop-commom-x.jar里面的core-default.xml文件取出并修改,添加如下代码:

    <property>
    <name>fs.hdfs.impl</name>
    <value>org.apache.hadoop.hdfs.DistributedFileSystem</value>
    <description>The FileSystem for hdfs: uris.</description>
    </property>

    或者应用代码使用时候,自行添加:

    configuration.set("fs.hdfs.impl", "org.apache.hadoop.hdfs.DistributedFileSystem");
  • 相关阅读:
    AcRxClass::addX
    string.format("%s",name)
    strcmp 与 _tcscmp
    acedinitget
    判断实体的类型 相关操作
    accmcolor
    CAD类型转换
    图的存储结构及遍历
    并查集(Union/Find)
    设计模式--缺醒适配器模式
  • 原文地址:https://www.cnblogs.com/felixzh/p/10268018.html
Copyright © 2011-2022 走看看