Spark 读取hdfs上的文件 错误:Caused by: java.io.IOException: Filesystem closed的处理
2017-03-10 14:07
639 查看
操作方式:使用HDFS的API 直接读取文件:
解决办法:
第一种方法:
源代码:FileSystem fs = FileSystem.get(URI.create(hdfsFilePath), config);
改为: FileSystem fs = FileSystem.newInstance(URI.create(hdfsFilePath), config);
第二种方法:
解决办法:
第一种方法:
源代码:FileSystem fs = FileSystem.get(URI.create(hdfsFilePath), config);
改为: FileSystem fs = FileSystem.newInstance(URI.create(hdfsFilePath), config);
第二种方法:
在hdfs core-site.xml里把fs.hdfs.impl.disable.cache设置为true
多个datanode在getFileSystem过程中,由于Configuration一样,会得到同一个FileSystem。如果有一个datanode在使用完关闭连接,其它的datanode在访问就会出现上述异常
相关文章推荐
- Caused by: java.io.IOException: Filesystem closed的处理
- spark程序异常:Exception in thread "main" java.io.IOException: No FileSystem for scheme: hdfs
- spark运行java-jar:Exception in thread "main" java.io.IOException: No FileSystem for scheme: hdfs
- spark 读取alluxio: Caused by: java.io.IOException: Block 38416150429696 is not available in Alluxio
- java.io.IOException: Filesystem closed
- java.io.IOException: No FileSystem for scheme: hdfs
- java.io.IOException: No FileSystem for scheme: hdfs异常解决
- 解决:java.io.IOException: No FileSystem for scheme: hdfs
- java.io.IOException: No FileSystem for scheme: hdfs
- POI读取EXCEL文件的错误 java.io.IOException: Invalid header signature; read 23
- java.io.IOException: No FileSystem for scheme: hdfs
- java.io.IOException: No FileSystem for scheme: hdfs异常解决
- (转载) Java IO 之 FileReader 读取文件打印在控制台(处理汉字乱码bug)
- Spark代码调试遇到的错误Caused by: java.net.URISyntaxException: Relative path in absolute URI: file:
- java.io.IOException: No FileSystem for scheme: hdfs
- 阿里巴巴dubbo处理文件上传下载 java.io.IOException: stream is closed
- java多线程运行结果写入文件错误java.io.IOException: Stream closed
- java.io.IOException: No FileSystem for scheme: hdfs
- java.io.IOException: No FileSystem for scheme: hdfs
- Java.io.IOException: No FileSystem for scheme: hdfs