Exception in thread "main" java.lang.IllegalArgumentException: Wrong FS: hdfs://192.168.1.251:9000/home/hep/hadoop-hep/mapred/system/jobtracker.info, expected: file:///
最后找到错误代码行:
方式一-指定HDFS的URI
14 | Configuration conf = new Configuration(); |
16 | hdfs = FileSystem.get(URI.create( "hdfs://192.168.1.251:9000/" ), conf); |
方式二-指定HDFS的配置文件
在Win7系统中创建一个core-site.xml文件:
02 | <? xml-stylesheet type = "text/xsl" href = "configuration.xsl" ?> |
07 | < name >fs.default.name</ name > |
09 | < value >hdfs://192.168.1.251:9000</ value > |
12 | < name >hadoop.tmp.dir</ name > |
13 | < value >/home/hm/hadoop-${user.name}</ value > |
13 | Configuration conf = new Configuration(); |
15 | conf.addResource( new Path( "c:/core-site.xml" )); |
17 | hdfs = FileSystem.get(conf); |