【SpringBoot】 ClassNotFoundException: Class com.jackroy.www.ServiceImpl.WordCountMap not found

  • Post author:
  • Post category:其他


【SpringBoot】Error: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class com.jackroy.www.ServiceImpl.WordCountMap not found



报错明细

IDEA SpringBoot集成hadoop运行环境,本地启动项目,GET请求接口触发远程提交MapReduce任务至生产集群报错:

Error: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class com.jackroy.www.ServiceImpl.WordCountMap not found
	at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2506)
	at org.apache.hadoop.mapreduce.task.JobContextImpl.getMapperClass(JobContextImpl.java:187)
	at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:759)
	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:347)
	at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:174)
	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:1729)
	at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:168)
Caused by: java.lang.ClassNotFoundException: Class com.jackroy.www.ServiceImpl.WordCountMap not found
	at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:2410)
	at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2504)
	... 8 more



问题解决

报错信息说的很清楚,找不到WordCountMap类,我们需要将项目打包,然后通过代码行指定我们的项目包路径:

job.setJar("D:\\project\\BigData\\target\\BigData-1.0.jar");

接着启动项目,重新请求提交:

在这里插入图片描述

问题解决。



后记

大家有什么问题可下方留言交流。



版权声明:本文为Jack_Roy原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。