1, need to put Hadoop.dll and Winutils.exe into the bin directory of Hadoop, my is: E:\Hadoop\hadoop-2.4.0\bin
2. The hadoop_home and path paths need to be configured. I have the following:
hadoop_home--e:\hadoop\hadoop-2.4.0
PATH ——.; %hadoop_home%\bin;
The above two notes can solve the error of running the WordCount report null pointer exception.
3, need to create a new Log4j.properties file in the project src directory, or there will be log4j warning prompt, as follows:
Log4j:warn No Appenders could is found for logger (org.apache.hadoop.metrics2.lib.MutableMetricsFactory). Log4j:warn Initialize the log4j system Properly.log4j:WARN see http://logging.apache.org/log4j/1.2/faq.html#noconfig for More info.
And it is not convenient to find the error message (very important), the Log4j.properties file contents are as follows:
Log4j.rootlogger=debug,stdout,r Log4j.appender.stdout=org.apache.log4j.consoleappender Log4j.appender.stdout.layout=org.apache.log4j.patternlayout log4j.appender.stdout.layout.conversionpattern=%5p- %m%n Log4j.appender.r=org.apache.log4j.rollingfileappender Log4j.appender.r.file=mapreduce_test.log LOG4J.APPENDER.R.MAXFILESIZE=1MB log4j.appender.r.maxbackupindex=1 log4j.appender.r.layout= Org.apache.log4j.PatternLayout log4j.appender.r.layout.conversionpattern=%p%t%c-%m%n Log4j.logger.com.codefutures=debug
4, after configuring the log4j, I will be prompted to say that there is no permission to write HDFs error, because in the Hadoop location where the username I default is administrator, and HDFs on my new directory permissions is root, So I use the chown command to change the directory and subdirectories have changed to administrator permissions, at this point can be normal operation WordCount.
This article is from the "Cabbage" blog, please be sure to keep this source http://dreamylights.blog.51cto.com/1163218/1591617
Win7+eclipse Configuring Hadoop development Environment Considerations