從hdfs下載到本地出現null chmod
1、錯誤資訊:
Exception in thread “main” java.io.IOException: (null) entry in command string: null chmod 0644 F:\hadoop_work\mygit\chapter03\code\project04\dir3
at org.apache.hadoop.util.Shell
LocalFSFileOutputStream.(RawLocalFileSystem.java:225)
at org.apache.hadoop.fs.RawLocalFileSystem
ChecksumFSOutputSummer.(ChecksumFileSystem.java:398)
at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:461)
at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:440)
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:911)
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:892)
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:789)
at org.apache.hadoop.fs.FileUtil.copy(FileUtil.java:365)
at org.apache.hadoop.fs.FileUtil.copy(FileUtil.java:338)
at org.apache.hadoop.fs.FileUtil.copy(FileUtil.java:289)
at org.apache.hadoop.fs.FileSystem.copyToLocalFile(FileSystem.java:2034)
at org.apache.hadoop.fs.FileSystem.copyToLocalFile(FileSystem.java:2003)
at org.apache.hadoop.fs.FileSystem.copyToLocalFile(FileSystem.java:1979)
at com.hdfs_basic.App.filedown(App.java:79)
at com.hdfs_basic.App.main(App.java:105)
2、原來的:
fs.copyToLocalFile(htfsfile, localfile);
3、解決方法:**
fs.copyToLocalFile(false,htfsfile, localfile,true);
第一個false引數表示不刪除原始檔,第4個true引數表示使用本地原檔案系統