0
votes

map 0% reduce 0% 15/02/03 07:30:28 INFO mapreduce.Job: Task Id : attempt_1422885720829_0097_m_000000_0, Status : FAILED Error: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class org.cognizant.pr2.TroubleMapper not found at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1720) at org.apache.hadoop.mapreduce.task.JobContextImpl.getMapperClass(JobContextImpl.java:186) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:721) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:339) at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:162) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:396) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1491) at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:157) Caused by: java.lang.ClassNotFoundException: Class org.cognizant.pr2.TroubleMapper not found at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1626) at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1718) ... 8 more

15/02/03 07:30:32 INFO mapreduce.Job: Task Id : attempt_1422885720829_0097_m_000000_1, Status : FAILED Error: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class org.cognizant.pr2.TroubleMapper not found at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1720) at org.apache.hadoop.mapreduce.task.JobContextImpl.getMapperClass(JobContextImpl.java:186) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:721) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:339) at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:162) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:396) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1491) at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:157) Caused by: java.lang.ClassNotFoundException: Class org.cognizant.pr2.TroubleMapper not found at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1626) at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1718) ... 8 more

15/02/03 07:30:35 INFO mapreduce.Job: Task Id : attempt_1422885720829_0097_m_000000_2, Status : FAILED Error: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class org.cognizant.pr2.TroubleMapper not found at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1720) at org.apache.hadoop.mapreduce.task.JobContextImpl.getMapperClass(JobContextImpl.java:186) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:721) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:339) at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:162) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:396) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1491) at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:157) Caused by: java.lang.ClassNotFoundException: Class org.cognizant.pr2.TroubleMapper not found at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1626) at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1718) ... 8 more

15/02/03 07:30:39 INFO mapreduce.Job: map 100% reduce 100% 15/02/03 07:30:39 INFO mapreduce.Job: Job job_1422885720829_0097 failed with state FAILED due to: Task failed task_1422885720829_0097_m_000000 Job failed as tasks failed. failedMaps:1 failedReduces:0

15/02/03 07:30:39 INFO mapreduce.Job: Counters: 6 Job Counters Failed map tasks=4 Launched map tasks=4 Other local map tasks=3 Data-local map tasks=1 Total time spent by all maps in occupied slots (ms)=8357 Total time spent by all reduces in occupied slots (ms)=0

3
I tried to run the MR code which is used to load the data from hdfs textfile to hbase table, but it was getting the error as shown above: "Mapper class not found exception" .While I am running the Mr code , I am passing the jar file , input path, output path, hbase table as arguments ... Plz hlp me I am strucked with this issue from two days, I used the suggestion like:" job.setJarByClass(TroubleDriver.class);"jeevan kishore
You were likely missing setJarByClass. See stackoverflow.com/a/40312088/578101mauhiz

3 Answers

1
votes

Re-compile your java code and make sure you have all jars existing to run mr jobs.

"su - hdfs" 

export HADOOP_CLASSPATH=`hbase classpath`

#### export HADOOP_CLASSPATH=/etc/hbase/conf:/usr/lib/hbase/*:jar

and run MR code!

1
votes

I got the solution for this issue like we can place the jar directly under this path:/usr/lib/hadoop-mapreduce directory and run the cmd from this path itself. Now It will be able to access the required one's. I hope it will be helpful. Thank you every one :-)

0
votes

I used the below Driver class Code to resolve this Problem.

public int run(String[] args) throws Exception {

    Configuration conf=new Configuration();
    Job job=Job.getInstance(conf, "MavenSample");

    ***job.setJarByClass(DriverClass.class);***

    job.setMapperClass(MapperClass.class);
    job.setReducerClass(ReducerClass.class);

    job.setMapOutputKeyClass(Text.class);
    job.setMapOutputValueClass(IntWritable.class);

    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(IntWritable.class);

    FileInputFormat.setInputPaths(job, new Path(args[0]));
    FileOutputFormat.setOutputPath(job, new Path(args[1]));         

    return job.waitForCompletion(true)?0:1;

}