Hadoop 运行jar包时 java.lang.ClassNotFoundException: Class com.zhen.mr.RunJob$HotMapper not found
Posted 嘣嘣嚓
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Hadoop 运行jar包时 java.lang.ClassNotFoundException: Class com.zhen.mr.RunJob$HotMapper not found相关的知识,希望对你有一定的参考价值。
错误如下
Error: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class com.zhen.mr.RunJob$HotMapper not found at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2154) at org.apache.hadoop.mapreduce.task.JobContextImpl.getMapperClass(JobContextImpl.java:186) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:742) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341) at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:163) 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:1692) at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158) Caused by: java.lang.ClassNotFoundException: Class com.zhen.mr.RunJob$HotMapper not found at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:2060) at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2152) ... 8 more
错误出现之前还有警告提示,如下
WARN mapreduce.JobResourceUploader: No job jar file set. User classes may not be found. See Job or Job#setJar(String).
提示说没有设置job jar
解决方法:
代码中给job对象set一下
job.setJarByClass(RunJob.class);
然后再打包运行就ok了。
以上是关于Hadoop 运行jar包时 java.lang.ClassNotFoundException: Class com.zhen.mr.RunJob$HotMapper not found的主要内容,如果未能解决你的问题,请参考以下文章
Hadoop java.lang.ClassNotFoundException: org.apache.commons.lang3.StringUtils
Hadoop-1,web页面调用报无hbase.jar包以解决 2,报java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.
运行HIVE命令抛出错误:线程“main”中的异常java.lang.RuntimeException:org.apache.hadoop.hive.ql.metadata.HiveException