windows下运行mapreduce报错Could not locate executable null bin winutils.exe in the Hadoop binaries 解决方案
程序员文章站
2022-05-09 15:23:36
...
笔者在windows下运行mapreduce报错,遇到如下错误Could not locate executable null bin winutils.exe in the Hadoop binaries,以下是错误和解决方案
错误如下:
D:\jdk1.8.0_144\bin\java -DHADOOP_USER_NAME=hadoop "-javaagent:D:\idea\IntelliJ IDEA 2017.1\lib\idea_rt.jar=52352:D:\idea\IntelliJ IDEA 2017.1\bin" -Dfile.encoding=UTF-8 -classpath D:\jdk1.8.0_144\jre\lib\charsets.jar;D:\jdk1.8.0_144\jre\lib\deploy.jar;D:\jdk1.8.0_144\jre\lib\ext\access-bridge-64.jar;D:\jdk1.8.0_144\jre\lib\ext\cldrdata.jar;D:\jdk1.8.0_144\jre\lib\ext\dnsns.jar;D:\jdk1.8.0_144\jre\lib\ext\jaccess.jar;D:\jdk1.8.0_144\jre\lib\ext\jfxrt.jar;D:\jdk1.8.0_144\jre\lib\ext\localedata.jar;D:\jdk1.8.0_144\jre\lib\ext\nashorn.jar;D:\jdk1.8.0_144\jre\lib\ext\sunec.jar;D:\jdk1.8.0_144\jre\lib\ext\sunjce_provider.jar;D:\jdk1.8.0_144\jre\lib\ext\sunmscapi.jar;D:\jdk1.8.0_144\jre\lib\ext\sunpkcs11.jar;D:\jdk1.8.0_144\jre\lib\ext\zipfs.jar;D:\jdk1.8.0_144\jre\lib\javaws.jar;D:\jdk1.8.0_144\jre\lib\jce.jar;D:\jdk1.8.0_144\jre\lib\jfr.jar;D:\jdk1.8.0_144\jre\lib\jfxswt.jar;D:\jdk1.8.0_144\jre\lib\jsse.jar;D:\jdk1.8.0_144\jre\lib\management-agent.jar;D:\jdk1.8.0_144\jre\lib\plugin.jar;D:\jdk1.8.0_144\jre\lib\resources.jar;D:\jdk1.8.0_144\jre\lib\rt.jar;D:\hadoop_code\java-mapreduce-demo\target\classes;D:\repo\org\apache\hadoop\hadoop-common\2.7.6\hadoop-common-2.7.6.jar;D:\repo\org\apache\hadoop\hadoop-annotations\2.7.6\hadoop-annotations-2.7.6.jar;D:\repo\com\google\guava\guava\11.0.2\guava-11.0.2.jar;D:\repo\commons-cli\commons-cli\1.2\commons-cli-1.2.jar;D:\repo\org\apache\commons\commons-math3\3.1.1\commons-math3-3.1.1.jar;D:\repo\xmlenc\xmlenc\0.52\xmlenc-0.52.jar;D:\repo\commons-httpclient\commons-httpclient\3.1\commons-httpclient-3.1.jar;D:\repo\commons-codec\commons-codec\1.4\commons-codec-1.4.jar;D:\repo\commons-io\commons-io\2.4\commons-io-2.4.jar;D:\repo\commons-net\commons-net\3.1\commons-net-3.1.jar;D:\repo\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;D:\repo\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar;D:\repo\org\mortbay\jetty\jetty\6.1.26\jetty-6.1.26.jar;D:\repo\org\mortbay\jetty\jetty-util\6.1.26\jetty-util-6.1.26.jar;D:\repo\org\mortbay\jetty\jetty-sslengine\6.1.26\jetty-sslengine-6.1.26.jar;D:\repo\javax\servlet\jsp\jsp-api\2.1\jsp-api-2.1.jar;D:\repo\com\sun\jersey\jersey-core\1.9\jersey-core-1.9.jar;D:\repo\com\sun\jersey\jersey-json\1.9\jersey-json-1.9.jar;D:\repo\org\codehaus\jettison\jettison\1.1\jettison-1.1.jar;D:\repo\com\sun\xml\bind\jaxb-impl\2.2.3-1\jaxb-impl-2.2.3-1.jar;D:\repo\org\codehaus\jackson\jackson-jaxrs\1.8.3\jackson-jaxrs-1.8.3.jar;D:\repo\org\codehaus\jackson\jackson-xc\1.8.3\jackson-xc-1.8.3.jar;D:\repo\com\sun\jersey\jersey-server\1.9\jersey-server-1.9.jar;D:\repo\asm\asm\3.1\asm-3.1.jar;D:\repo\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;D:\repo\net\java\dev\jets3t\jets3t\0.9.0\jets3t-0.9.0.jar;D:\repo\org\apache\httpcomponents\httpclient\4.1.2\httpclient-4.1.2.jar;D:\repo\org\apache\httpcomponents\httpcore\4.1.2\httpcore-4.1.2.jar;D:\repo\com\jamesmurty\utils\java-xmlbuilder\0.4\java-xmlbuilder-0.4.jar;D:\repo\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;D:\repo\commons-configuration\commons-configuration\1.6\commons-configuration-1.6.jar;D:\repo\commons-digester\commons-digester\1.8\commons-digester-1.8.jar;D:\repo\commons-beanutils\commons-beanutils\1.7.0\commons-beanutils-1.7.0.jar;D:\repo\commons-beanutils\commons-beanutils-core\1.8.0\commons-beanutils-core-1.8.0.jar;D:\repo\org\slf4j\slf4j-api\1.7.10\slf4j-api-1.7.10.jar;D:\repo\org\slf4j\slf4j-log4j12\1.7.10\slf4j-log4j12-1.7.10.jar;D:\repo\org\codehaus\jackson\jackson-core-asl\1.9.13\jackson-core-asl-1.9.13.jar;D:\repo\org\codehaus\jackson\jackson-mapper-asl\1.9.13\jackson-mapper-asl-1.9.13.jar;D:\repo\org\apache\avro\avro\1.7.4\avro-1.7.4.jar;D:\repo\com\thoughtworks\paranamer\paranamer\2.3\paranamer-2.3.jar;D:\repo\org\xerial\snappy\snappy-java\1.0.4.1\snappy-java-1.0.4.1.jar;D:\repo\com\google\protobuf\protobuf-java\2.5.0\protobuf-java-2.5.0.jar;D:\repo\com\google\code\gson\gson\2.2.4\gson-2.2.4.jar;D:\repo\org\apache\hadoop\hadoop-auth\2.7.6\hadoop-auth-2.7.6.jar;D:\repo\org\apache\directory\server\apacheds-kerberos-codec\2.0.0-M15\apacheds-kerberos-codec-2.0.0-M15.jar;D:\repo\org\apache\directory\server\apacheds-i18n\2.0.0-M15\apacheds-i18n-2.0.0-M15.jar;D:\repo\org\apache\directory\api\api-asn1-api\1.0.0-M20\api-asn1-api-1.0.0-M20.jar;D:\repo\org\apache\directory\api\api-util\1.0.0-M20\api-util-1.0.0-M20.jar;D:\repo\org\apache\curator\curator-framework\2.7.1\curator-framework-2.7.1.jar;D:\repo\com\jcraft\jsch\0.1.54\jsch-0.1.54.jar;D:\repo\org\apache\curator\curator-client\2.7.1\curator-client-2.7.1.jar;D:\repo\org\apache\curator\curator-recipes\2.7.1\curator-recipes-2.7.1.jar;D:\repo\com\google\code\findbugs\jsr305\3.0.0\jsr305-3.0.0.jar;D:\repo\org\apache\htrace\htrace-core\3.1.0-incubating\htrace-core-3.1.0-incubating.jar;D:\repo\org\apache\zookeeper\zookeeper\3.4.6\zookeeper-3.4.6.jar;D:\repo\org\apache\commons\commons-compress\1.4.1\commons-compress-1.4.1.jar;D:\repo\org\tukaani\xz\1.0\xz-1.0.jar;D:\repo\org\apache\hadoop\hadoop-hdfs\2.7.6\hadoop-hdfs-2.7.6.jar;D:\repo\commons-daemon\commons-daemon\1.0.13\commons-daemon-1.0.13.jar;D:\repo\io\netty\netty\3.6.2.Final\netty-3.6.2.Final.jar;D:\repo\io\netty\netty-all\4.0.23.Final\netty-all-4.0.23.Final.jar;D:\repo\xerces\xercesImpl\2.9.1\xercesImpl-2.9.1.jar;D:\repo\xml-apis\xml-apis\1.3.04\xml-apis-1.3.04.jar;D:\repo\org\fusesource\leveldbjni\leveldbjni-all\1.8\leveldbjni-all-1.8.jar;D:\repo\org\apache\hadoop\hadoop-mapreduce-client-core\2.7.6\hadoop-mapreduce-client-core-2.7.6.jar;D:\repo\org\apache\hadoop\hadoop-yarn-common\2.7.6\hadoop-yarn-common-2.7.6.jar;D:\repo\org\apache\hadoop\hadoop-yarn-api\2.7.6\hadoop-yarn-api-2.7.6.jar;D:\repo\javax\xml\bind\jaxb-api\2.2.2\jaxb-api-2.2.2.jar;D:\repo\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;D:\repo\javax\activation\activation\1.1\activation-1.1.jar;D:\repo\com\sun\jersey\jersey-client\1.9\jersey-client-1.9.jar;D:\repo\com\google\inject\guice\3.0\guice-3.0.jar;D:\repo\javax\inject\javax.inject\1\javax.inject-1.jar;D:\repo\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;D:\repo\com\sun\jersey\contribs\jersey-guice\1.9\jersey-guice-1.9.jar;D:\repo\com\google\inject\extensions\guice-servlet\3.0\guice-servlet-3.0.jar;D:\repo\org\apache\hadoop\hadoop-mapreduce-client-jobclient\2.7.6\hadoop-mapreduce-client-jobclient-2.7.6.jar;D:\repo\org\apache\hadoop\hadoop-mapreduce-client-common\2.7.6\hadoop-mapreduce-client-common-2.7.6.jar;D:\repo\org\apache\hadoop\hadoop-yarn-client\2.7.6\hadoop-yarn-client-2.7.6.jar;D:\repo\org\apache\hadoop\hadoop-yarn-server-common\2.7.6\hadoop-yarn-server-common-2.7.6.jar;D:\repo\org\apache\hadoop\hadoop-mapreduce-client-shuffle\2.7.6\hadoop-mapreduce-client-shuffle-2.7.6.jar;D:\repo\org\apache\hadoop\hadoop-yarn-server-nodemanager\2.7.6\hadoop-yarn-server-nodemanager-2.7.6.jar;D:\repo\log4j\log4j\1.2.17\log4j-1.2.17.jar;D:\repo\junit\junit\4.12\junit-4.12.jar;D:\repo\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar com.mapreduce.two.WordCount -D mapred.jar=D:\hadoop_code\java-mapreduce-demo\target\java-mapreduce-demo-1.0-SNAPSHOT.jar /input /output
[ERROR] 2018-08-03 10:17:38,835 method:org.apache.hadoop.util.Shell.getWinUtilsPath(Shell.java:400)
Failed to locate the winutils binary in the hadoop binary path
java.io.IOException: Could not locate executable E:\Linux\hadoop-2.7.6\bin\winutils.exe in the Hadoop binaries.
at org.apache.hadoop.util.Shell.getQualifiedBinPath(Shell.java:382)
at org.apache.hadoop.util.Shell.getWinUtilsPath(Shell.java:397)
at org.apache.hadoop.util.Shell.<clinit>(Shell.java:390)
at org.apache.hadoop.util.GenericOptionsParser.preProcessForWindows(GenericOptionsParser.java:440)
at org.apache.hadoop.util.GenericOptionsParser.parseGeneralOptions(GenericOptionsParser.java:486)
at org.apache.hadoop.util.GenericOptionsParser.<init>(GenericOptionsParser.java:170)
at org.apache.hadoop.util.GenericOptionsParser.<init>(GenericOptionsParser.java:153)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:64)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)
at com.mapreduce.two.WordCount.main(WordCount.java:92)
[DEBUG] 2018-08-03 10:17:39,179 method:org.apache.hadoop.metrics2.lib.MutableMetricsFactory.newForField(MutableMetricsFactory.java:42)
解决方案:
1、下载hadoop和winutils
hadoop:http://hadoop.apache.org/releases.html
winutils:https://download.csdn.net/download/hg_harvey/10275997
2、替换文件
解压hadoop及winutils,将winutils解压后的所有文件覆盖到hadoop的bin目录下
复制winutils目录下的hadoop.dll文件到C:\windows\system32目录下