hException in thread "main" java.lang.IllegalArgumentException: Wrong FS: hdfs://hadoop:9000/tadoop:

在执行Java代码时遇到了'Exception in thread "main" java.lang.IllegalArgumentException: Wrong FS'的问题,错误指出预期的文件系统是file:///,但实际连接的是hdfs://hadoop:9000。解决方法是将Hadoop集群的core-site.xml和hdfs-site.xml配置文件复制到工程目录下,特别是对于在Eclipse中使用的工作目录,确保在bin文件夹下,以便正确访问远程HDFS。" 89081444,7803843,Django实现基础分页教程,"['Django框架', '数据库操作', '网页开发', '后端开发', '数据渲染']

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

java代码如下: 

 FileSystem fs = FileSystem.get(conf);

        if (fs.exists(inputDir)) {
            throw new IOException(String.format("Input directory '%s' exists - please remove and rerun this example", inputDir));
        }

        OutputStreamWriter writer = new OutputStreamWriter(fs.create(new Path(inputDir, "input2.txt")));
            writer.write(JSON);

抛出异常如下:Exception in thread "main" java.lang.IllegalArgumentException: Wrong FS: hdfs://hadoop:9000/test/input, expected: file:///

at org.apache.hadoop.fs.FileSystem.checkPath(FileSystem.java:381)
at org.apache.hadoop.fs.RawLocalFileSystem.pathToFile(RawLocalFileSystem.java:55)
at org.apache.hadoop.fs.LocalFileSystem.pathToFile(LocalFileSystem.java:61)
at org.apache.hadoop.fs.LocalFileSystem
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值