此文章是博主自己在idea中用spark 编写wordcount时出现的报错,以及采取的解决办法,在寻找解决办法时寻求了网络的帮助,仅供学习参考使用,不作他用
问题:Did not find winutils.exe: {}
21/12/06 22:38:58 WARN Shell: Did not find winutils.exe: {}
java.io.FileNotFoundException: Could not locate Hadoop executable: D:\main\hadoop-3.1.3\bin\winutils.exe -see https://wiki.apache.org/hadoop/WindowsProblems
at org.apache.hadoop.util.Shell.getQualifiedBinInner(Shell.java:620)
at org.apache.hadoop.util.Shell.getQualifiedBin(Shell.java:593)
at org.apache.hadoop.util.Shell.(Shell.java:690)
at org.apache.hadoop.util.StringUtils.(StringUtils.java:78)
原因:非程序的错误,而是windows系统用到lhadoop相关的服务
解决方法:通过配置关联到windows的系统依赖
因为用的是hadoop 3.1.3版本,但是在github上没有,所以可以取相近的版本3.1.2,由于github比较慢,这里就使用的Gitee。到这里边下载地址去下载里边的winutils.exe和hadoop.dll文件,并放到你安装目录下的bin目录下
同时需要配置系统变量

其他方法:
上述进行修补的操作,目前有部分的API会出现兼容问题,这里建议换成hadoop 3.1.2,本文发表的这个时间github上并没有3.1.3相关的包,使用3.1.2也是差不多

问题:
Exception in thread "main" java.lang.IllegalAccessError:tried to access method com.google.common.base.Stopwatch.<init>()V from class org.apache.hadoop.mapre
解决:在pom.xml(spark-core)中添加下面代码
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>${hadoop.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-core</artifactId>
<version>${hadoop.version}</version>
</dependency>
2万+

被折叠的 条评论
为什么被折叠?



