Eclipse调用HDFS API上传文件时出现了如下错误:

Exception in thread "main" java.lang.IllegalArgumentException: Wrong FS: hdfs://master:9000/user/Administrator, expected: file:///
at org.apache.hadoop.fs.FileSystem.checkPath(FileSystem.java:659)
at org.apache.hadoop.fs.RawLocalFileSystem.pathToFile(RawLocalFileSystem.java:82)
at org.apache.hadoop.fs.RawLocalFileSystem.deprecatedGetFileStatus(RawLocalFileSystem.java:585)
at org.apache.hadoop.fs.RawLocalFileSystem.getFileLinkStatusInternal(RawLocalFileSystem.java:803)
at org.apache.hadoop.fs.RawLocalFileSystem.getFileStatus(RawLocalFileSystem.java:580)
at org.apache.hadoop.fs.FilterFileSystem.getFileStatus(FilterFileSystem.java:425)
at org.apache.hadoop.fs.FileSystem.exists(FileSystem.java:1414)
at org.apache.hadoop.fs.FileUtil.checkDest(FileUtil.java:499)
at org.apache.hadoop.fs.FileUtil.copy(FileUtil.java:351)
at org.apache.hadoop.fs.FileUtil.copy(FileUtil.java:341)
at org.apache.hadoop.fs.FileUtil.copy(FileUtil.java:292)
at org.apache.hadoop.fs.LocalFileSystem.copyFromLocalFile(LocalFileSystem.java:82)
at org.apache.hadoop.fs.FileSystem.copyFromLocalFile(FileSystem.java:1884)
at com.hellohadoop.FileOperator.Upload(FileOperator.java:48)
at com.hellohadoop.FileOperator.main(FileOperator.java:23)

解决的办法是把Hadoop集群的hdfs-site.xml和core-site.xml两个配置文件复制到项目的bin目录下面,就可以正常运行了。

Wrong FS: hdfs://xxx/xxx expected: file:///的更多相关文章

  1. Hadoop问题记录:Wrong FS: hdfs://hp5-249:9000/, expected: file:///

    一般在对文件操作的时候可能出现这个问题,可能是打开文件的时候出错,也可能是对文件夹进行遍历的时候出问题. 出现这样的问题通常是在eclipse中执行hadoop的时候出现,直接切换到shell下发送命 ...

  2. hadoop程序问题:java.lang.IllegalArgumentException: Wrong FS: hdfs:/ expected file:///

    Java代码如下: FileSystem fs = FileSystem.get(conf); in = fs.open(new Path("hdfs://192.168.130.54:19 ...

  3. hadoop运行报错Wrong FS: hdfs:/, expected: file:///

    内容源自:https://blog.csdn.net/u014470581/article/details/51480600 报错信息: Exception in thread "main& ...

  4. Error Domain=ASIHTTPRequestErrorDomain Code=8 "Failed to move file from"xxx/xxx"to"xxx/xxx"

    今天真的好高兴呀 我解决了一个折磨了我一周的问题,真的是激动地要哭出来了,为了这个问题,我嘴也烂了,头发抓了一地啊.虽然解决方法,最后还是展现出了“百度”的伟大,但是我还是很开心,在这里我展示一下我的 ...

  5. Visual Studio发布Web项目报错:Unable to add 'xxx' to the Web site. Unable to add file 'xxx'. The specified file could not be encrypted.

    背景 Visual Studio下的Web项目 现象 发布时遇到Unable to add 'xxx' to the Web site.  Unable to add file 'xxx'. The ...

  6. RLException: XXX is neither a launch file in package XXX nor is XXX a launch file name问题解决

    在运行roslaunch时出现了类似下面的错误: RLException: XXX is neither a launch file in package XXX nor is XXX a launc ...

  7. Cocos2d-x执行时错误:Cocos2d: Get data from file(xxx.xxx) failed!

    取资源图片时遇到执行时错误: Cocos2d: Get data from file(xxx/xxx.xxx) failed! 原因是我加入资源目录的方式不正确,例如以下图,我选择的是在Resourc ...

  8. 多数据源报错 expected single matching bean but found 2: xxx,xxx

    问题: expected single matching bean but found 2: xxx,xxx 原因:在 Spring 容器中配置了两个类型Bean,Spring 容器将无法确定到底要用 ...

  9. Error creating bean with name 'XXX' defined in file

    这个错误是我在之前操作时,错将另一个dubbo服务器也加载到了该dubbo服务器上(pom.xml),所以出现了Error creating bean with name 'XXX' defined ...

随机推荐

  1. 自定义兼容多种Protobuf协议的编解码器

    <从零开始搭建游戏服务器>自定义兼容多种Protobuf协议的编解码器 直接在protobuf序列化数据的前面,加上一个自定义的协议头,协议头里包含序列数据的长度和对应的数据类型,在数据解 ...

  2. 让Less在Dreamweaver中高亮显示

    装的Dreamweavercs6还是没支持less啊,试过几种方法,感觉还是插件比较直接, 下载插件:http://download.csdn.net/download/lml_231/8556517 ...

  3. JDK配置 linux

    在启动终端并输入 gedit /etc/profile 在末尾添加一下配置,保存并退出 #set jdk environment export JAVA_HOME=/usr/lib/jvm/jdk1. ...

  4. 用SparseArray代替HashMap

    SparseArray是android提供的一个工具类,它可以用来替代hashmap进行对象的存储,其内部实现了一个矩阵压缩算法,很适合存储稀疏矩阵的. PS:support包中还提供了兼容的类Spa ...

  5. SimpleAdapter和AutoCompleteTextView配合使用

     修改后成为这样→    package com.kale.autocompletetextview; import java.util.ArrayList; import java.util.Has ...

  6. tf.argmax

    tf.argmax(input, axis=None, name=None, dimension=None) Returns the index with the largest value acro ...

  7. 【ContestHunter】【弱省胡策】【Round6】

    KMP/DP+树链剖分+线段树/暴力 今天考的真是……大起大落…… String QwQ题意理解又出错了……(还是说一开始理解了,后来自己又忘了为什么是这样了?) 反正最后的结果就是……我当成:后面每 ...

  8. Swift:宏定义

    一.简述 swift中并没有加入宏系统,C语言使用#define定义的基本常量在导入Swift时被Swift编译自动转为Swfit语言的全局变量.但复杂的宏定义不能被Swift转换.Swift中类似宏 ...

  9. B/S架构中常用弹出方法 (转)

    <一> 在B/S架构的项目中,为了提高项目的易用性,增强系统与用户的交互功能,一般使用弹出页面来为用户提供操作或数据选择帮助信息,比如,用户输入一个编码中某些字符,在弹出页面中显示所有包含 ...

  10. Matplotlib.pyplot 常用方法

    1.介绍 Matplotlib 是一个 Python 的 2D绘图库,它以各种硬拷贝格式和跨平台的交互式环境生成出版质量级别的图形.通过 Matplotlib,开发者可以仅需要几行代码,便可以生成绘图 ...