A Brief introduction
Debugging HADOOP2 code on eclipse under Windows, So we configured the Hadoop-eclipse-plugin-2.6.0.jar plugin under Windows Eclipse, and there was a series of problems running the Hadoop code, and it took days to finally run the code. Next we look at the problem and how to solve it, providing the same problems as I have encountered as a reference.
The Wordcount.java statistics code for HADOOP2 is as follows:
package org.apache.hadoop.examples;import java.io.ioexception;import java.util.stringtokenizer; 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.mapper;import Org.apache.hadoop.mapreduce.reducer;import org.apache.hadoop.mapreduce.lib.input.fileinputformat;import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;public class WordCount { public static class tokenizermapper extends mapper<object, text, text, intwritable>{ private final static intwritable one = new intwritable (1); private text word = new text (); public&nbSp;void map (object key, text value, context context ) throws IOException, InterruptedException { StringTokenizer Itr = new stringtokenizer (Value.tostring ()); while ( Itr.hasmoretokens ()) { word.set (Itr.nextToken ()); context.write (word, one); } } } public static class IntSumReducer extends Reducer<Text,IntWritable,Text,IntWritable> { private intwritable result = new intwritable (); Public void reducE (text key, iterable<intwritable> values, context context ) throws IOException, InterruptedException { int sum = 0; for (intwritable val : values) { sum += val.get () ; } result.set (sum); context.write (Key, result); } } public static void main (String[] args) throws Exception { configuration conf&Nbsp;= new configuration (); job job = job.getinstance (conf, "Word count"); job.setjarbyclass (Wordcount.class); Job.setmapperclass (Tokenizermapper.class); job.setcombinerclass (IntSumReducer.class); job.setreducerclass (intsumreducer.class); job.setoutputkeyclass (Text.class); job.setoutputvalueclass (Intwritable.class); Fileinputformat.addinputpath (Job, new path (args[0)); Fileoutputformat.setoutputpath (Job, new path (args[1)); system.exit ( Job.waitforcompletion (True) ? 0 : 1); }}
Question one. An internal error occurred during: "Map/reducelocation status Updater". Java.lang.NullPointerException
We hadoop-eclipse-plugin-2.6.0.jar into Eclipse's plugins directory, our Eclipse directory is F:\tool\eclipse-jee-juno-SR2\ Eclipse-jee-juno-sr2\plugins, restart Eclipse, and then, open window-->preferens, you can see the Hadoop map/reduc option, and then click an internal Error occurredduring: "Map/reduce location Status Updater". Java.lang.NullPointerException,:
Solve:
We found that the HADOOP2 that just configured the deployment had not yet created the input and output directories, and first built a folder on HDFs.
#bin/hdfs Dfs-mkdir–p/user/root/input
#bin/hdfs dfs-mkdir-p/user/root/output
We see these two directories in the DFS locations directory of Eclipse:
Hadoop-eclipse-plugin-2.6.0.jar Configuration issues under Windows