您的位置:首页 > 大数据 > Hadoop

拷贝本地文件至HDFS异常:No FileSystem for scheme: file

2016-11-13 15:40 543 查看
具体异常信息:

=======copy file=======

Exception in thread “main” java.io.IOException: No FileSystem for scheme: file

at org.apache.hadoop.fs.FileSystem.getFileSystemClass(FileSystem.java:2644)

at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2651)

at org.apache.hadoop.fs.FileSystem.access200(FileSystem.java:92)atorg.apache.hadoop.fs.FileSystemCache.getInternal(FileSystem.java:2687)

at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2669)

at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:371)

at org.apache.hadoop.fs.FileSystem.getLocal(FileSystem.java:342)

at org.apache.hadoop.fs.FileSystem.copyFromLocalFile(FileSystem.java:1965)

at org.apache.hadoop.fs.FileSystem.copyFromLocalFile(FileSystem.java:1933)

at org.apache.hadoop.fs.FileSystem.copyFromLocalFile(FileSystem.java:1898)

at com.mofeng.hdfsTest.OperatingFiles.copyFile(OperatingFiles.java:40)

at com.mofeng.hdfsTest.OperatingFiles.main(OperatingFiles.java:88)

解决办法:

需要在pom文件中添加:

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.mofeng.hdfsTest.OperatingFiles</mainClass>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>


内容中的

<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  hdfs scheme exception