java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.
找不到hadoop的二进制文件winutils.exe。
1.读取hbase数据你首先需要一个client,jar包里不集成windows环境client的。
2.你需要一个可以运行的client——windows环境下就是exe(hbase默认是安装在linux下的)。
3.hbase是完全依赖hadoop的,hadoop为了满足windows用户,提供了启动环境,在hadoopX.X/bin/下边的winutils.exe。(可以到github下载https://github.com/srccodes/hadoop-common-2.2.0-bin,同样也可以适用于hadoop2.6.X)
4.此路径的引用是用HADOOP_HOME变量或者是hadoop.home.dir配置都可以读取的,我们可以在代码中指定位置。System.setProperty("hadoop.home.dir", "D:/hadoop-common-2.2.0");java设置系统环境变量,其中winutils.exe就在D:/hadoop-common-2.2.0/bin/就目录下(建议这样方便)
5.也可以通过配置系统环境变量HADOOP_HOME和PATH,重启eclipse即可。
17:43:16.217 ERROR org.apache.hadoop.util.Shell 373 getWinUtilsPath - Failed to locate the winutils binary in the hadoop binary path java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.
at org.apache.hadoop.util.Shell.getQualifiedBinPath(Shell.java:355) ~[hadoop-common-2.6.4.jar:?]
at org.apache.hadoop.util.Shell.getWinUtilsPath(Shell.java:370) [hadoop-common-2.6.4.jar:?]
at org.apache.hadoop.util.Shell.<clinit>(Shell.java:363) [hadoop-common-2.6.4.jar:?]
at org.apache.hadoop.util.StringUtils.<clinit>(StringUtils.java:79) [hadoop-common-2.6.4.jar:?]
at org.apache.hadoop.security.Groups.parseStaticMapping(Groups.java:116) [hadoop-common-2.6.4.jar:?]
at org.apache.hadoop.security.Groups.<init>(Groups.java:93) [hadoop-common-2.6.4.jar:?]
at org.apache.hadoop.security.Groups.<init>(Groups.java:73) [hadoop-common-2.6.4.jar:?]
at org.apache.hadoop.security.Groups.getUserToGroupsMappingService(Groups.java:293) [hadoop-common-2.6.4.jar:?]
at org.apache.hadoop.security.Groups.getUserToGroupsMappingService(Groups.java:278) [hadoop-common-2.6.4.jar:?]
at org.apache.hadoop.hbase.security.UserProvider.<clinit>(UserProvider.java:56) [hbase-common-1.2.3.jar:1.2.3]
at org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(ConnectionFactory.java:214) [hbase-client-1.2.3.jar:1.2.3]
at org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(ConnectionFactory.java:119) [hbase-client-1.2.3.jar:1.2.3]
at hbase.com.cn.Query.init(Query.java:45) [bin/:?]
at hbase.com.cn.Query.listTables(Query.java:116) [bin/:?]
at hbase.com.cn.Query.main(Query.java:27) [bin/:?]