在程序中给Configuration做以下设置:

conf.set("fs.hdfs.impl", "org.apache.hadoop.hdfs.DistributedFileSystem")