0

Trying to run a job, but i keep getting this error. I do not know how to resolve it. Is there something im missing? What is wrong here?

This is in my shell

[cloudera@localhost home]$ hadoop jar cloudera/MinMaxCountDriver.jar MinMaxCount /user/cloudera/Comments.xml /user/cloudera/SuperUserXML/

This is the error i am getting Exception in thread "main" java.lang.ClassNotFoundException: MinMaxCount .... at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at org.apache.hadoop.util.RunJar.main(RunJar.java:201)

Here is my driver.

public class MinMaxCountDriver {
public static void main(String []args) throws Exception
{
    Configuration conf = new Configuration();
    String [] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();

    if(otherArgs.length !=2 )
    {
        System.err.println("You need 2 Arguement");
        System.exit(2);
    }

    ...

    FileInputFormat.addInputPath(job, new Path(otherArgs[0]));
    FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));

    System.exit(job.waitForCompletion(true)? 0: 1);

}

}
7
  • Is your class in a package? Commented Apr 28, 2014 at 18:22
  • I have a driver class, a mapper and a reducer all packaged into MinMaxCountDriver.jar Commented Apr 28, 2014 at 18:39
  • Yes but are your classes in a package? Like com.example.plugin... Commented Apr 28, 2014 at 18:40
  • Yes. The Driver, Mapper and Reducer are all in the same package, along with a writable class. all 4 are packaged into the .jar Commented Apr 28, 2014 at 20:45
  • Again... not what I'm asking. The beginning of your .java should have a package specifier like package com.example....., you need to qualify your class name with that package.. like com.whatever.MinMaxClass Commented Apr 28, 2014 at 20:52

2 Answers 2

1

Basic command to run MR jobs is

hadoop jar myjar.jar classname inputfolder outputfolder

For me it works without classname also

myproject
  |
  |
   -----> mypackage
           |
           |
           ---->Driver.java
           |
           |
           ---->Mapper.java
           |
           |
           ---->Reducer.java

If this is the tree I need not want to specify the classname

hadoop jar driver.jar in out

But

myproject
      |
      |
       -----> mypackage
      |        |
      |        |
      |        ---->Driver.java
      |        |
      |        |
      |        ---->Mapper.java
      |        |
      |        |
      |        ---->Reducer.java
      | 
      ----> mypackage2
               |
               |
                ---->Driver2.java
               |
               |
               ---->Mapper2.java
               |
               |
               ---->Reducer2.java

For this I need to specify my classname which driver class I am trying to execute.

hadoop jar driver2.jar mypackage2.Driver2 in out
Sign up to request clarification or add additional context in comments.

Comments

0

Each class in the .jar has [package MapRedDesign;] at the top.

Based on your comments, make sure you fully qualify your class name with the package, otherwise Java will have no idea where to find it.

hadoop jar cloudera/MinMaxCountDriver.jar MapRedDesign.MinMaxCount /user/cloudera/Comments.xml /user/cloudera/SuperUserXML/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.