Spakr- ERROR 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.

运行

mport org.apache.log4j.{Level, Logger}
import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

/**
 * Created by Lee_Rz on 2017/8/30.
 */
object SparkDemo {
  def main(args: Array[String]) {
    Logger.getLogger("org.apache.spark").setLevel(Level.OFF)
    val sc: SparkContext = new SparkContext(new SparkConf().setAppName(this.getClass().getName()).setMaster("local[2]"))
    val rdd1: RDD[String] = sc.textFile("C:\\Users\\166\\Desktop\\text.txt")   //一行一行的读数据   //懒算子
    val key: RDD[(String, Int)] = rdd1.flatMap(_.split(" ")).map((_,1)).reduceByKey(_+_)
    println(key.collect().toBuffer)//收集到Driver
  }
}

报错

Using Spark‘s default log4j profile: org/apache/spark/log4j-defaults.properties
17/09/02 13:01:15 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
17/09/02 13:01:17 INFO Slf4jLogger: Slf4jLogger started
17/09/02 13:01:17 INFO Remoting: Starting remoting
17/09/02 13:01:17 INFO Remoting: Remoting started; listening on addresses :[akka.tcp://[email protected]:51388]
17/09/02 13:01:18 ERROR 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:278)
    at org.apache.hadoop.util.Shell.getWinUtilsPath(Shell.java:300)
    at org.apache.hadoop.util.Shell.<clinit>(Shell.java:293)
    at org.apache.hadoop.util.StringUtils.<clinit>(StringUtils.java:76)
    at org.apache.hadoop.mapred.FileInputFormat.setInputPaths(FileInputFormat.java:362)
    at org.apache.spark.SparkContext$$anonfun$hadoopFile$1$$anonfun$33.apply(SparkContext.scala:1015)
    at org.apache.spark.SparkContext$$anonfun$hadoopFile$1$$anonfun$33.apply(SparkContext.scala:1015)
    at org.apache.spark.rdd.HadoopRDD$$anonfun$getJobConf$6.apply(HadoopRDD.scala:176)
    at org.apache.spark.rdd.HadoopRDD$$anonfun$getJobConf$6.apply(HadoopRDD.scala:176)
    at scala.Option.map(Option.scala:145)
    at org.apache.spark.rdd.HadoopRDD.getJobConf(HadoopRDD.scala:176)
    at org.apache.spark.rdd.HadoopRDD.getPartitions(HadoopRDD.scala:195)
    at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
    at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
    at scala.Option.getOrElse(Option.scala:120)
    at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
    at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
    at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
    at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
    at scala.Option.getOrElse(Option.scala:120)
    at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
    at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
    at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
    at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
    at scala.Option.getOrElse(Option.scala:120)
    at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
    at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
    at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
    at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
    at scala.Option.getOrElse(Option.scala:120)
    at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
    at org.apache.spark.Partitioner$.defaultPartitioner(Partitioner.scala:65)
    at org.apache.spark.rdd.PairRDDFunctions$$anonfun$reduceByKey$3.apply(PairRDDFunctions.scala:331)
    at org.apache.spark.rdd.PairRDDFunctions$$anonfun$reduceByKey$3.apply(PairRDDFunctions.scala:331)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:150)
    at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:111)
    at org.apache.spark.rdd.RDD.withScope(RDD.scala:316)
    at org.apache.spark.rdd.PairRDDFunctions.reduceByKey(PairRDDFunctions.scala:330)
    at zx.SparkDemo$.main(SparkDemo.scala:15)
    at zx.SparkDemo.main(SparkDemo.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
17/09/02 13:01:19 INFO FileInputFormat: Total input paths to process : 1
17/09/02 13:01:19 INFO deprecation: mapred.tip.id is deprecated. Instead, use mapreduce.task.id
17/09/02 13:01:19 INFO deprecation: mapred.task.id is deprecated. Instead, use mapreduce.task.attempt.id
17/09/02 13:01:19 INFO deprecation: mapred.task.is.map is deprecated. Instead, use mapreduce.task.ismap
17/09/02 13:01:19 INFO deprecation: mapred.task.partition is deprecated. Instead, use mapreduce.task.partition
17/09/02 13:01:19 INFO deprecation: mapred.job.id is deprecated. Instead, use mapreduce.job.id
ArrayBuffer((are,2), (hello,1), (any,1), (ok,4), (world,1), (me,1), (alone,1), (you,2), (no,1), (believie,1), (more,1))
17/09/02 13:01:19 INFO RemoteActorRefProvider$RemotingTerminator: Shutting down remote daemon.

Process finished with exit code 0

检查发现hadoop下bin目录下已经存在winutils.exe,检查hadoop的path路径,发现没有严格按照格式创建hadoop的path,真确的格式是HADOOP_HOME=......,因为在hadoop的生态圈中很多框架都是依赖hadoop的,所以他们的配置文件中,默认的export的hadoop路径是格式是HADOOP_HOME

时间: 2024-11-03 21:07:27

Spakr- ERROR 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.的相关文章

windows 中使用hbase 异常:java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.

平时一般是在windows环境下进行开发,在windows 环境下操作hbase可能会出现异常(java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.),以前也遇到过这个问题,今天又有小伙伴遇到这个问题,就顺带记一笔,异常信息如下: 2016-05-23 17:02:13,551 WARN [org.apache.hadoop.util.NativeCodeLoa

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

在已经搭建好的集群环境Centos6.6+Hadoop2.7+Hbase0.98+Spark1.3.1下,在Win7系统Intellij开发工具中调试Spark读取Hbase.运行直接报错: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 15/06/11 15:35:50 ERROR Shell: Failed to locate the winutils binary in the

spark开发常见问题之一:java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.

最近在学习研究pyspark机器学习算法,执行代码出现以下异常: 19/06/29 10:08:26 ERROR Shell: Failed to locate the winutils binary in the hadoop binary pathjava.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.at org.apache.hadoop.util.Shel

executable null\bin\winutils.exe in the Hadoop binaries.

在windows 使用eclipse远程调用hadoop集群时抛出下面异常 executable null\bin\winutils.exe in the Hadoop binaries. 这个问题 (1)你没有设置hadoop的环境变量,所以提示 null\bin\....... (2)你没有 winutils.exe winutils.exe的下载地址:https://github.com/srccodes/hadoop-common-2.2.0-bin (不用担心版本问题,我Hadoop2

源码追踪,解决Could not locate executable null\bin\winutils.exe in the Hadoop binaries.问题

在windows系统本地运行spark的wordcount程序,会出现一个异常,但不影响现有程序运行. >>提君博客原创  http://www.cnblogs.com/tijun/  << 总归是一个异常,老是爆红,看着心烦,下面是异常信息 提君博客原创 让我们源码追踪一下,看看到底是什么原因导致,点击第一行爆红的异常信息提示,就是(shell.java:355) 看到我的截图提示,大概了解什么原因了.发现HADOOP_HOME_DIR为null,右边outline里面找到一个私

Could not locate executable null\bin\winutils.exe in the Hadoop binaries解决方式 spark运行wordcoult

虽然可以正常运行,但是会出异常,现给出解决方法. 1.问题:   2.  问题解决: 仔细查看报错是缺少winutils.exe程序. Hadoop都是运行在Linux系统下的,在windows下eclipse中运行mapreduce程序,要首先安装Windows下运行的支持插件 3.  安装并配置插件(我这里还是Linux版的hadoop安装包,我们只需要下载一个winutils.exe文件即可) 1.文件解压后如下(添加winutils.exe):   2.设置环境变量(第一个在环境变量下创

解决ERROR Shell: Failed to locate the winutils binary in the hadoop binary path java.io.IOException: C

今天在IDEA开发工具上面跑了一个任务,结果出现了:如下图: 解决办法:没有配置hadoop的环境变量 1.首先下载一个win10环境下的hadoop 2.配置path的hadoop的环境 3.配置HADOOP _HOME的路径 原文地址:https://www.cnblogs.com/yumengfei/p/11426841.html

spark-local-运行异常-Could not locate executable null\bin\winutils.exe in the Hadoop binaries

windows下-local模式-运行spark: 1.下载winutils的windows版本 GitHub上,有人提供了winutils的windows的版本,项目地址是:https://github.com/srccodes/hadoop-common-2.2.0-bin,直接下载此项目的zip包,下载后是文件名是hadoop-common-2.2.0-bin-master.zip,随便解压到一个目录 2.配置环境变量 增加用户变量HADOOP_HOME,值是下载的zip包解压的目录,然后

ERROR Shell: Failed to locate the winutils binary in the hadoop binary path

14/12/17 19:18:53 ERROR 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.jav