Hadoop 运行jar包时 java.lang.ClassNotFoundException: Class com.zhen.mr.RunJob$HotMapper not found
学向勤中得,萤窗万卷书。这篇文章主要讲述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);
【Hadoop 运行jar包时 java.lang.ClassNotFoundException: Class com.zhen.mr.RunJob$HotMapper not found】然后再打包运行就ok了。
推荐阅读
- Android中对Handle机制的理解
- Android 开发之 ---- bootloader (LK)
- CentOS7/RHEL7如何修改swappiness值()
- android studio ndk-builld方式开发
- 如何修复Mac上的“你的系统已用完应用程序内存”错误()
- 如何将Windows 11恢复出厂设置(操作方法分步指南)
- 如何在Windows 11上打开蓝牙(4种简单方法指南)
- 如果我的Mac不断重启怎么办(解决问题的10个技巧)
- 如何在Windows 11中清除缓存(7种有效方法指南)