把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.access
200
(
F
i
l
e
S
y
s
t
e
m
.
j
a
v
a
:
88
)
a
t
o
r
g
.
a
p
a
c
h
e
.
h
a
d
o
o
p
.
f
s
.
F
i
l
e
S
y
s
t
e
m
200(FileSystem.java:88) at org.apache.hadoop.fs.FileSystem
200(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)</pre>
原因一般是,少导入hadoop-hdfs.jar这个jar包,
导入该包后,重新ant编译,提交任务,运行正常!