hadoop2.7.3 hbase 1.3.1 Could not locate executable null\bin\winutils.exe in the Hadoop binaries.

时间:2021-01-20 08:27:18

使用hbase客户端连接集群时发现这个错误:
说不能执行本地的winutils.exe,我是在windows上连接集群的,确实没有设置hadoop的环境变量。而且hadoop2.7.3的bin下也没有winutils.exe这个可执行文件。
hadoop2.7.3 hbase 1.3.1 Could not locate executable null\bin\winutils.exe in the Hadoop binaries.

经百度发现:是少了hadoop-common-2.2.0-bin这个包
这是下载地址:https://github.com/srccodes/hadoop-common-2.2.0-bin
下载:
hadoop2.7.3 hbase 1.3.1 Could not locate executable null\bin\winutils.exe in the Hadoop binaries.
这就是可执行文件winutils.exe:
hadoop2.7.3 hbase 1.3.1 Could not locate executable null\bin\winutils.exe in the Hadoop binaries.
然后在代码开始加入变量:

System.setProperty("hadoop.home.dir", "F:/soft/hadoop/hadoop-common-2.2.0-bin-master");

也可以在系统环境变量中添加HADOOP_HOME,在path中添加%HADOOP_HOME%\bin,但是这种方法视乎要重启才能生效。
hadoop2.7.3 hbase 1.3.1 Could not locate executable null\bin\winutils.exe in the Hadoop binaries.

hadoop2.7.3 hbase 1.3.1 Could not locate executable null\bin\winutils.exe in the Hadoop binaries.
设置之后运行代码:前两行就没有报错了:
hadoop2.7.3 hbase 1.3.1 Could not locate executable null\bin\winutils.exe in the Hadoop binaries.