用eclipse 编写java程序连接hadoop 报
File not found 错误
-
File not found
-
java.lang.IllegalArgumentException: Wrong FS: hdfs://10.14.2.201:9000/user/hadoop, expected: file:///
-
at org.apache.hadoop.fs.FileSystem.checkPath(FileSystem.java:390)
-
at org.apache.hadoop.fs.RawLocalFileSystem.pathToFile(RawLocalFileSystem.java:55)
-
at org.apache.hadoop.fs.RawLocalFileSystem.mkdirs(RawLocalFileSystem.java:340)
-
at org.apache.hadoop.fs.ChecksumFileSystem.mkdirs(ChecksumFileSystem.java:492)
-
at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:377)
-
at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:364)
-
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:564)
-
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:545)
-
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:452)
-
at test.Write.main(Write.java:18)
解决方法:
把hadoop的core-site.xml hdfs-site.xml 放到和java包同目录下
例如test包名下存放了访问hadoop的java程序,那么core-site.xml hdfs-site.xml 和test应同级目录
阅读(2355) | 评论(0) | 转发(0) |