eclipse下执行wordcount报错 java.lang.ClassNotFoundException 解决办法
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了eclipse下执行wordcount报错 java.lang.ClassNotFoundException 解决办法相关的知识,希望对你有一定的参考价值。
eclipse下执行wordcount报错 java.lang.ClassNotFoundException
17/08/29 07:52:54 INFO Configuration.deprecation: fs.default.name is deprecated. Instead, use fs.defaultFS
17/08/29 07:52:54 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
17/08/29 07:52:55 INFO client.RMProxy: Connecting to ResourceManager at /192.168.93.130:8032
17/08/29 07:52:56 WARN mapreduce.JobResourceUploader: No job jar file set. User classes may not be found. See Job or Job#setJar(String).
17/08/29 07:52:56 INFO input.FileInputFormat: Total input paths to process : 2
17/08/29 07:52:56 INFO mapreduce.JobSubmitter: number of splits:2
17/08/29 07:52:56 INFO Configuration.deprecation: mapred.job.tracker is deprecated. Instead, use mapreduce.jobtracker.address
17/08/29 07:52:56 INFO Configuration.deprecation: fs.default.name is deprecated. Instead, use fs.defaultFS
17/08/29 07:52:56 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1503848790903_0013
17/08/29 07:52:56 INFO mapred.YARNRunner: Job jar is not present. Not adding any jar to the list of resources.
17/08/29 07:52:56 INFO impl.YarnClientImpl: Submitted application application_1503848790903_0013
17/08/29 07:52:56 INFO mapreduce.Job: The url to track the job: http://master:18088/proxy/application_1503848790903_0013/
17/08/29 07:52:56 INFO mapreduce.Job: Running job: job_1503848790903_0013
17/08/29 07:53:04 INFO mapreduce.Job: Job job_1503848790903_0013 running in uber mode : false
17/08/29 07:53:04 INFO mapreduce.Job: map 0% reduce 0%
17/08/29 07:53:09 INFO mapreduce.Job: Task Id : attempt_1503848790903_0013_m_000001_0, Status : FAILED
Error: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class com.asiainfo.demo.count.WorldTest$MyWorld not found
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2195)
at org.apache.hadoop.mapreduce.task.JobContextImpl.getMapperClass(JobContextImpl.java:186)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:745)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164)
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:1698)
at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.lang.ClassNotFoundException: Class com.asiainfo.demo.count.WorldTest$MyWorld not found
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:2101)
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2193)
... 8 more
17/08/29 07:53:09 INFO mapreduce.Job: Task Id : attempt_1503848790903_0013_m_000000_0, Status : FAILED
Error: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class com.asiainfo.demo.count.WorldTest$MyWorld not found
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2195)
at org.apache.hadoop.mapreduce.task.JobContextImpl.getMapperClass(JobContextImpl.java:186)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:745)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164)
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:1698)
at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.lang.ClassNotFoundException: Class com.asiainfo.demo.count.WorldTest$MyWorld not found
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:2101)
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2193)
... 8 more
17/08/29 07:53:14 INFO mapreduce.Job: Task Id : attempt_1503848790903_0013_m_000001_1, Status : FAILED
Error: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class com.asiainfo.demo.count.WorldTest$MyWorld not found
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2195)
at org.apache.hadoop.mapreduce.task.JobContextImpl.getMapperClass(JobContextImpl.java:186)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:745)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164)
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:1698)
at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.lang.ClassNotFoundException: Class com.asiainfo.demo.count.WorldTest$MyWorld not found
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:2101)
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2193)
... 8 more
17/08/29 07:53:14 INFO mapreduce.Job: Task Id : attempt_1503848790903_0013_m_000000_1, Status : FAILED
Error: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class com.asiainfo.demo.count.WorldTest$MyWorld not found
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2195)
at org.apache.hadoop.mapreduce.task.JobContextImpl.getMapperClass(JobContextImpl.java:186)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:745)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164)
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:1698)
at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.lang.ClassNotFoundException: Class com.asiainfo.demo.count.WorldTest$MyWorld not found
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:2101)
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2193)
... 8 more
17/08/29 07:53:19 INFO mapreduce.Job: Task Id : attempt_1503848790903_0013_m_000001_2, Status : FAILED
Error: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class com.asiainfo.demo.count.WorldTest$MyWorld not found
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2195)
at org.apache.hadoop.mapreduce.task.JobContextImpl.getMapperClass(JobContextImpl.java:186)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:745)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164)
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:1698)
at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.lang.ClassNotFoundException: Class com.asiainfo.demo.count.WorldTest$MyWorld not found
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:2101)
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2193)
... 8 more
17/08/29 07:53:20 INFO mapreduce.Job: Task Id : attempt_1503848790903_0013_m_000000_2, Status : FAILED
Error: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class com.asiainfo.demo.count.WorldTest$MyWorld not found
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2195)
at org.apache.hadoop.mapreduce.task.JobContextImpl.getMapperClass(JobContextImpl.java:186)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:745)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164)
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:1698)
at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.lang.ClassNotFoundException: Class com.asiainfo.demo.count.WorldTest$MyWorld not found
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:2101)
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2193)
... 8 more
Container killed by the ApplicationMaster.
Container killed on request. Exit code is 143
Container exited with a non-zero exit code 143
17/08/29 07:53:25 INFO mapreduce.Job: map 100% reduce 100%
17/08/29 07:53:25 INFO mapreduce.Job: Job job_1503848790903_0013 failed with state FAILED due to: Task failed task_1503848790903_0013_m_000001
Job failed as tasks failed. failedMaps:1 failedReduces:0
17/08/29 07:53:25 INFO mapreduce.Job: Counters: 13
Job Counters
Failed map tasks=8
Killed reduce tasks=1
Launched map tasks=8
Other local map tasks=6
Data-local map tasks=2
Total time spent by all maps in occupied slots (ms)=28393
Total time spent by all reduces in occupied slots (ms)=0
Total time spent by all map tasks (ms)=28393
Total time spent by all reduce tasks (ms)=0
Total vcore-milliseconds taken by all map tasks=28393
Total vcore-milliseconds taken by all reduce tasks=0
Total megabyte-milliseconds taken by all map tasks=29074432
Total megabyte-milliseconds taken by all reduce tasks=0
1
修改Configuration 配置
Configuration conf = new Configuration();
conf.set("fs.default.name", "hdfs://192.168.93.130:9000");
conf.set("mapred.job.tracker", "9001");
conf.set("hadoop.job.user", "root");
conf.set("mapreduce.framework.name", "yarn");
conf.set("yarn.resourcemanager.address", "192.168.93.130:8032");
conf.set("mapreduce.jobtracker.address","192.168.93.130:9001");
conf.set("yarn.resourcemanager.hostname", "192.168.93.130");
conf.set("yarn.resourcemanager.admin.address", "192.168.93.130:8033");
conf.set("yarn.resourcemanager.address", "192.168.93.130:8032");
conf.set("yarn.resourcemanager.resource-tracker.address", "192.168.93.130:8036");
conf.set("yarn.resourcemanager.scheduler.address", "192.168.93.130:8030");
conf.set("mapred.jar", "/eclipse-jee/eclipse/demo.jar");
String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
if (otherArgs.length != 2) {
System.out.println("stage not exis input output");
System.exit(2);
}
Job job = new Job(conf, "job" + Calendar.getInstance().getTimeInMillis());
//job.setJarByClass(WorldTest.class);
//job.setJar("/eclipse-jee/eclipse/demo.jar");
job.setMapperClass(MyWorld.class);
job.setCombinerClass(MyReduce.class);
job.setReducerClass(MyReduce.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
FileInputFormat.addInputPath(job, new Path(otherArgs[0]));
FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));
System.out.println(job.waitForCompletion(true) ? 0 : 1);
本文出自 “一代宗师” 博客,请务必保留此出处http://765682.blog.51cto.com/755682/1960340
以上是关于eclipse下执行wordcount报错 java.lang.ClassNotFoundException 解决办法的主要内容,如果未能解决你的问题,请参考以下文章
eclipse通过maven进行打包并且对hdfs上的文件进行wordcount
在MapReduce中运行WordCount以及字数统计中遇到的问题