title: Incomaptible argument to the function error in MapReduce program
body: <p>I am working on a MapReduce Java project in eclipse (on Ubuntu 14.04LTS) for which I am using Apache Avro serialization framework for that I need avro-tools-1.7.7.jar file. I have downloaded this jar from apache website and I have written the java code using the downloaded jar. When I execute the program I am getting java.lang.VerifyError error. I have read from few website that this error is due to a version mismatch between the JDK version of compiled class files in the jar to the runtime JDK version so I checked the versions of the downloaded jar file .class version and my runtime JVM version and there was a mismatch so I downgraded my JDK from 1.7 to  1.6 and there was no mismatch. The compiled classes in jar has 50 as thier major version and so are my current project class files. but I am still getting that error.</p>
  
  <pre><code>srimanth@srimanth-Inspiron-N5110:~$ hadoop jar Desktop/AvroMapReduceExamples.jar practice.AvroSort file:///home/srimanth/avrofile.avro file:///home/srimanth/sorted/ test.avro
  15/04/19 22:14:36 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
  Exception in thread "main" java.lang.VerifyError: (class: org/apache/hadoop/mapred/JobTrackerInstrumentation, method: create signature: (Lorg/apache/hadoop/mapred/JobTracker;Lorg/apache/hadoop/mapred/JobConf;)Lorg/apache/hadoop/mapred/JobTrackerInstrumentation;) Incompatible argument to function
      at org.apache.hadoop.mapred.LocalJobRunner.&lt;init&gt;(LocalJobRunner.java:420)
      at org.apache.hadoop.mapred.JobClient.init(JobClient.java:470)
      at org.apache.hadoop.mapred.JobClient.&lt;init&gt;(JobClient.java:455)
      at org.apache.hadoop.mapred.JobClient.runJob(JobClient.java:1252)
      at practice.AvroSort.run(AvroSort.java:63)
      at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
      at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)
      at practice.AvroSort.main(AvroSort.java:67)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:622)
      at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
      at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
  </code></pre>
  
  <p>Here is my java program</p>
  
  <pre><code>package practice;
  
  import java.io.File;
  import java.io.IOException;
  
  import org.apache.avro.Schema;
  import org.apache.avro.mapred.AvroCollector;
  import org.apache.avro.mapred.AvroJob;
  import org.apache.avro.mapred.AvroMapper;
  import org.apache.avro.mapred.AvroReducer;
  import org.apache.avro.mapred.Pair;
  import org.apache.hadoop.conf.Configured;
  import org.apache.hadoop.fs.Path;
  import org.apache.hadoop.mapred.FileInputFormat;
  import org.apache.hadoop.mapred.FileOutputFormat;
  import org.apache.hadoop.mapred.JobClient;
  import org.apache.hadoop.mapred.JobConf;
  import org.apache.hadoop.mapred.Reporter;
  import org.apache.hadoop.util.Tool;
  import org.apache.hadoop.util.ToolRunner;
  
  public class AvroSort extends Configured implements Tool {
  static class SortMapper&lt;K&gt; extends AvroMapper&lt;K, Pair&lt;K, K&gt;&gt; {
      public void map(K datum, AvroCollector&lt;Pair&lt;K, K&gt;&gt; collector,
              Reporter reporter) throws IOException {
          collector.collect(new Pair&lt;K, K&gt;(datum, null, datum, null));
      }
  }
      static class SortReducer&lt;K&gt; extends AvroReducer&lt;K, K, K&gt; {
          public void reduce(K key, Iterable&lt;K&gt; values,
                  AvroCollector&lt;K&gt; collector,
                  Reporter reporter) throws IOException {
              for (K value : values) {
                  collector.collect(value);
              }
          }
      }
  @Override
      public int run(String[] args) throws Exception {
      if (args.length != 3) {
  
          System.err.printf(
                  "Usage: %s [generic options] &lt;input&gt; &lt;output&gt; &lt;schema-file&gt;\n",
                  getClass().getSimpleName());
          ToolRunner.printGenericCommandUsage(System.err);
          return -1;
      }
      String input = args[0];
      String output = args[1];
      String schemaFile = args[2];
      JobConf conf = new JobConf(getConf(), getClass());
      conf.setJobName("Avro sort");
      FileInputFormat.addInputPath(conf, new Path(input));
      FileOutputFormat.setOutputPath(conf, new Path(output));
      Schema schema = new Schema.Parser().parse(new File(schemaFile));
      AvroJob.setInputSchema(conf, schema);
      Schema intermediateSchema = Pair.getPairSchema(schema, schema);
      AvroJob.setMapOutputSchema(conf, intermediateSchema);
      AvroJob.setOutputSchema(conf, schema);
      AvroJob.setMapperClass(conf, SortMapper.class);
      AvroJob.setReducerClass(conf, SortReducer.class);
  
      JobClient.runJob(conf);
      return 0;
      }
      public static void main(String[] args) throws Exception {
          int exitCode = ToolRunner.run(new AvroSort(), args);
          System.exit(exitCode);
      }
  }
  </code></pre>
  
  <p>Additional info: JDK version : 1.6 ,
                   Hadoop Version : 2.6.0 and I am not using maven. </p>
  
  <p>please help me I am stuck at here this entire day. I really appreciate some help.</p>