在Windows下的idea中访问HDFS报错 Could not locate executable null\bin\winutils.exe

18/09/08 20:18:33 ERROR util.Shell: 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:379)
    at org.apache.hadoop.util.Shell.getWinUtilsPath(Shell.java:394)
    at org.apache.hadoop.util.Shell.<clinit>(Shell.java:387)
    at org.apache.hadoop.util.StringUtils.<clinit>(StringUtils.java:80)
    at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:2823)
    at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:2818)
    at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2684)
    at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:373)
    at org.apache.hadoop.fs.FileSystem$1.run(FileSystem.java:162)
    at org.apache.hadoop.fs.FileSystem$1.run(FileSystem.java:159)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:422)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1698)
    at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:159)
    at ls.hdfs.HDFSMain.main(HDFSMain.java:28)

 

解决方案:

在windows下解压Hadoop按照包,并且把winutils.exe放入解压包的bin目录下

百度云下载winutils链接

最后在程序配置一下环境变量即可

System.setProperty("hadoop.home.dir", "D:\\hadoop\\hadoop-2.7.3");
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值