任何人都可以帮助我解决此错误吗?
package bigdata.tp1;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.log4j.BasicConfigurator;
public class WordCount {
public static void main(String[] args) throws Exception {
BasicConfigurator.configure();
Configuration conf = new Configuration();
Path inputPath=new Path(args[0]);
Path outputPath=new Path(args[1]);// ligne 16
Job job = Job.getInstance(conf, "wordcount");
job.setJarByClass(WordCount.class);
job.setMapperClass(MyMapper.class);
job.setCombinerClass(MyReducer.class);
job.setReducerClass(MyReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
FileInputFormat.addInputPath(job, inputPath);
FileOutputFormat.setOutputPath(job,outputPath);
if (!job.waitForCompletion(true))
return;
}
}
线程“主”中的异常java.lang.ArrayIndexOutOfBoundsException:索引1超出长度1的范围在bigdata.tp1.WordCount.main(WordCount.java:16)
好像您想访问第二个comandline参数,而只提供一个参数。在访问之前,请检查参数计数。