首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

hadoop下传本地文件到hdfs报错

2012-12-20 
hadoop上传本地文件到hdfs报错public static void Copy() throws IOException{Configuration cfg new Co

hadoop上传本地文件到hdfs报错

public static void Copy() throws IOException{Configuration cfg = new Configuration();FileSystem hdfs = FileSystem.get(cfg);//File file = new File("C:\\XXX\\API\\ss.txt");Path src = new Path("C://XXX/API/ss.txt"); Path dst = new Path("/");hdfs.copyFromLocalFile(src, dst);System.out.println("uploud to "+ cfg.get("fs.default.name"));FileStatus files[] = hdfs.listStatus(dst);for(FileStatus file : files){System.out.println(file.getPath());}} 

当我执行上述代码的时候总是报拒绝访问ss.txt文件。不知什么原因。ss.txt可以在本地打开,能够用java的一般IO读写操作。希望哪位帮我看看什么问题。

热点排行