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);

}

}
有帮助吗?

解决方案 2

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/

其他提示

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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top