把eclipse中的hadoop项目,换了一个工作空间,再次启动任务时,发现报如下异常:
java">java.io.IOException: No FileSystem for scheme: hdfs
at org.apache.hadoop.fs.FileSystem.getFileSystemClass(FileSystem.java:2421)
at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2428)
at org.apache.hadoop.fs.FileSystem.access200(FileSystem.java:88)atorg.apache.hadoop.fs.FileSystem200(FileSystem.java:88) at org.apache.hadoop.fs.FileSystem200(FileSystem.java:88)atorg.apache.hadoop.fs.FileSystemCache.getInternal(FileSystem.java:2467)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2449)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:367)
at FileCopyToHdfs.readFromHdfs(FileCopyToHdfs.java:65)
at FileCopyToHdfs.main(FileCopyToHdfs.java:26)
原因一般是,少导入hadoop-hdfs.jar这个jar包,
导入该包后,重新ant编译,提交任务,运行正常!