title: java.lang.RuntimeException: java.lang.ClassNotFoundException when trying to run Jar job on Elastic MapReduce
body: <p>What should I change to fix following error:</p>
  
  <p>I'm trying to start a job on Elastic Mapreduce, and it crashes every time with message:</p>
  
  <pre><code>java.lang.RuntimeException: java.lang.ClassNotFoundException: iataho.mapreduce.NewMaxTemperatureMapper
  at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:831)
  at org.apache.hadoop.mapreduce.JobContext.getMapperClass(JobContext.java:157)
  at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:577)
  at org.apache.hadoop.mapred.MapTask.run(MapTask.java:310)
  at org.apache.hadoop.mapred.Child.main(Child.java:170)
  Caused by: java.lang.ClassNotFoundException: iataho.mapreduce.NewMaxTemperatureMapper
  at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
  at java.lang.Class.forName0(Native Method)
  at java.lang.Class.forName(Class.java:247)
  at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:778)
  at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:829)
  ... 4 more
  </code></pre>
  
  <p>The class <strong>NewMaxTemperatureMapper</strong> is declared and I've checked, it is included in the jar, which is than located at s3. 
  Here's the code for all app classes:</p>
  
  <p><strong>NewMaxTemperature.java:</strong></p>
  
  <pre><code>package iataho.mapreduce;
  
  import org.apache.hadoop.fs.Path;
  import org.apache.hadoop.io.IntWritable;
  import org.apache.hadoop.io.Text;
  import org.apache.hadoop.mapreduce.Job;
  import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
  import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
  
  public class NewMaxTemperature {
  /**
   * @param args
   */
  public static void main(String[] args) {
  
      try {
          if (args.length != 2) {
              System.err.println("Usage: NewMaxTemperature &lt;input path&gt; &lt;output path&gt;");
              System.exit(123);
          }
          Job job = new Job();
          job.setJarByClass(NewMaxTemperature.class);
          FileInputFormat.addInputPath(job, new Path(args[0]));
          FileOutputFormat.setOutputPath(job, new Path(args[1]));
  
          job.setMapperClass(NewMaxTemperatureMapper.class);
          job.setCombinerClass(NewMaxTemperatureReducer.class);
          job.setReducerClass(NewMaxTemperatureReducer.class);
  
          job.setOutputKeyClass(Text.class);
          job.setOutputValueClass(IntWritable.class);
          System.exit(job.waitForCompletion(true) ? 0 : 1);
      } catch (Exception e) {
          e.printStackTrace();
      }
  
  }
  
  }
  </code></pre>
  
  <p><strong>NewMaxTemperatureReducer.java:</strong></p>
  
  <pre><code>package iataho.mapreduce;
  
  import java.io.IOException;
  
  import org.apache.hadoop.io.IntWritable;
  import org.apache.hadoop.io.Text;
  import org.apache.hadoop.mapreduce.Reducer;
  
  public class NewMaxTemperatureReducer extends Reducer&lt;Text, IntWritable, Text, IntWritable&gt; {
  public void reduce(Text key, Iterable&lt;IntWritable&gt; values, Context context) throws IOException, InterruptedException {
      int maxValue = Integer.MIN_VALUE;
      for (IntWritable value : values) {
          maxValue = Math.max(maxValue, value.get());
      }
      context.write(key, new IntWritable(maxValue));
  }
  }
  </code></pre>
  
  <p><strong>NewMaxTemperatureMapper.java:</strong></p>
  
  <pre><code>package iataho.mapreduce;
  
  import java.io.IOException;
  
  import org.apache.hadoop.io.IntWritable;
  import org.apache.hadoop.io.LongWritable;
  import org.apache.hadoop.io.Text;
  import org.apache.hadoop.mapreduce.Mapper;
  
  public class NewMaxTemperatureMapper extends Mapper&lt;LongWritable, Text, Text, IntWritable&gt; {
  private static final int    MISSING = 9999;
  
  public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
      String line = value.toString();
      String year = line.substring(15, 19);
      int airTemperature;
      if (line.charAt(87) == '+') { // parseInt doesn't like leading plus
                                      // signs
          airTemperature = Integer.parseInt(line.substring(88, 92));
      } else {
          airTemperature = Integer.parseInt(line.substring(87, 92));
      }
      String quality = line.substring(92, 93);
      if (airTemperature != MISSING &amp;&amp; quality.matches("[01459]")) {
          context.write(new Text(year), new IntWritable(airTemperature));
      }
  }
  }
  </code></pre>
  
  <p>I've made the jar file with which I'm getting this crash avaliable here: <a href="http://www.iathao.com/jars/test.jar" rel="nofollow">download jar</a></p>