java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.

1:这个问题都被大家玩烂了,这里我也记载一下,方便以后脑补:

 1 SLF4J: Class path contains multiple SLF4J bindings.
 2 SLF4J: Found binding in [jar:file:/E:/360Downloads/hadoop-2.4.1/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
 3 SLF4J: Found binding in [jar:file:/E:/360Downloads/hbase-0.99.2/lib/slf4j-log4j12-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
 4 SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
 5 SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
 6 2017-12-18 18:06:27,778 WARN  [main] util.NativeCodeLoader (NativeCodeLoader.java:<clinit>(62)) - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
 7 2017-12-18 18:06:27,786 ERROR [main] util.Shell (Shell.java:getWinUtilsPath(336)) - Failed to locate the winutils binary in the hadoop binary path
 8 java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.
 9     at org.apache.hadoop.util.Shell.getQualifiedBinPath(Shell.java:318)
10     at org.apache.hadoop.util.Shell.getWinUtilsPath(Shell.java:333)
11     at org.apache.hadoop.util.Shell.<clinit>(Shell.java:326)
12     at org.apache.hadoop.util.StringUtils.<clinit>(StringUtils.java:76)
13     at org.apache.hadoop.security.Groups.parseStaticMapping(Groups.java:93)
14     at org.apache.hadoop.security.Groups.<init>(Groups.java:77)
15     at org.apache.hadoop.security.Groups.getUserToGroupsMappingService(Groups.java:240)
16     at org.apache.hadoop.security.UserGroupInformation.initialize(UserGroupInformation.java:255)
17     at org.apache.hadoop.security.UserGroupInformation.ensureInitialized(UserGroupInformation.java:232)
18     at org.apache.hadoop.security.UserGroupInformation.loginUserFromSubject(UserGroupInformation.java:718)
19     at org.apache.hadoop.security.UserGroupInformation.getLoginUser(UserGroupInformation.java:703)
20     at org.apache.hadoop.security.UserGroupInformation.getCurrentUser(UserGroupInformation.java:605)
21     at org.apache.hadoop.hbase.security.User$SecureHadoopUser.<init>(User.java:256)
22     at org.apache.hadoop.hbase.security.User$SecureHadoopUser.<init>(User.java:252)
23     at org.apache.hadoop.hbase.security.User.getCurrent(User.java:156)
24     at org.apache.hadoop.hbase.security.UserProvider.getCurrent(UserProvider.java:88)
25     at org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(ConnectionFactory.java:215)
26     at org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(ConnectionFactory.java:119)
27     at com.hbaseTest.HbaseTest.init(HbaseTest.java:57)
28     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
29     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
30     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
31     at java.lang.reflect.Method.invoke(Method.java:606)
32     at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
33     at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
34     at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
35     at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
36     at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
37     at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
38     at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
39     at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
40     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
41     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
42     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
43     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
44     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
45     at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
46     at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
47     at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
48     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
49     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
50     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
51     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

我是测试Hbase创建数据表的时候遇到的这种问题,总之吧,window操作hadoop都会遇到这种问题:

 1 第一步:自己配置window的环境变量(很明显应该是HADOOP_HOME的问题。如果HADOOP_HOME为空,必然fullExeName为null\bin\winutils.exe。解决方法很简单,配置环境变量,)。
 2 第二步:不想重启电脑可以在程序里加上:
 3 System.setProperty("hadoop.home.dir", "C:\\Users\\Administrator\\Desktop\\hadoop-2.7.3\\hadoop-2.7.3");
 4 比如我添加到此处:
 5 @Before
 6     public void init() throws Exception {
 7         System.setProperty("hadoop.home.dir", "E:\\hadoop-2.6.4");
 8         // 配置
 9         config = HBaseConfiguration.create();
10         // zookeeper地址
11         config.set("hbase.zookeeper.quorum", "master,slaver1,slaver2");
12         // zookeeper端口
13         config.set("hbase.zookeeper.property.clientPort", "2181");
14         // 通过工厂模式创建一个Connection
15         connection = ConnectionFactory.createConnection(config);
16         // 通过Connection获取表连接
17         table = connection.getTable(TableName.valueOf("user"));
18 }
19 第三步:去https://github.com/srccodes/hadoop-common-2.2.0-bin/tree/master/bin    
20 下载winutils.exe文件复制到自己的E:\hadoop-2.6.4\bin目录里面。
21 第四步:重新运行程序就OK了,问题解决。

停更......

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏光变

Maven运行sonar出错

Maven运行sonar报错 Unable to determine structure of project. Probably you use Maven ...

712
来自专栏c#开发者

Clean up your BizTalk databases

Here are a few scripts / stored procedures that most of the BizTalk newbies woul...

3316
来自专栏JackieZheng

Spring实战——通过Java代码装配bean

  上篇说的是无需半行xml配置完成bean的自动化注入。这篇仍然不要任何xml配置,通过Java代码也能达到同样的效果。   这么说,是要把上篇的料拿出来再煮...

2635
来自专栏编程坑太多

springboot (三)JdbcTemplate

1214
来自专栏PPV课数据科学社区

【学习】七天搞定SAS(三):基本模块调用

搞定基本的函数之后,开始鼓捣SAS里面的模型。也就是说,要开始写PROC了。说实话,越学SAS,越觉得SAS像Stata...无论是从输出的样式,还是语法。好不...

2885
来自专栏数据和云

RMAN CATALOG命令手动注册磁带库中的备份片

ORACLE 官方文档中介绍 CATALOG 命令只能注册在磁盘中的备份片,在现在多数环境中备份时,备份集都是放到磁带库中,那么 CATALOG 命令真就不支持...

1191
来自专栏文渊之博

利用PowerShell复制SQLServer账户的所有权限

问题   对于DBA或者其他运维人员来说授权一个账户的相同权限给另一个账户是一个很普通的任务。但是随着服务器、数据库、应用、使用人员地增加就变得很枯燥乏味又耗时...

2548
来自专栏码匠的流水账

reactor-rabbitmq小试牛刀

reactor-rabbitmq对rabbitmq的api进行封装,改造为reactive streams模式,提供了Non-blocking Back-pre...

623
来自专栏蓝天

__lll_mutex_lock_wait的错误原因

运行下面的代码,即可重现上面的__lll_mutex_lock_wait()问题:

1564
来自专栏机器学习从入门到成神

Spring与MyBatis的整合

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sinat_35512245/articl...

2032

扫码关注云+社区