第一个错误:无法连接到DFS Locations
Error:Call to master/192.168.1.125:9000 failed on connection exception:java.net.ConnectException:Connection refused
错误分析:未启动hadoop进程
解决办法:在命令行中通过start-all.sh启动所有hadoop进程
第二个错误:运行实例时出现数组出界异常
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException:0
FileInputFormat.setInputPaths(conf,new Path(args[0]));
FileOutputFormat.setOutputPath(conf,new Path(args[1]));
错误分析:数组出界,说明main(String[] args)里面的args数组并没有获得具体的值,也就是说我并没有参数给args,所以就不存在arg[0]和arg[1]。
解决办法:在run configuration里面设置参数,即设置输入文件的路径和输出文件的路径,如下图
注意:输入路径和输出路径根据自己的实际情况设置