The Hortonworks Community Connection is now live. A completely rebuilt Q&A forum, Knowledge Base, Code Hub and more, backed by the experts in the industry.

You will be redirected here in 10 seconds. If your are not redirected, click here to visit the new site.

The legacy Hortonworks Forum is now closed. You can view a read-only version of the former site by clicking here. The site will be taken offline on January 31,2016

HDFS Forum

Web App mapreduce job failing

  • #29963
    John Brinnand

    I have a mapreduce job which I am executing from a web application. The jobs starts up but it fails with the following well known error:

    java.lang.Exception: Type mismatch in key from map: expected, recieved
    at org.apache.hadoop.mapred.LocalJobRunner$
    Caused by: Type mismatch in key from map: expected, recieved

    I have followed the general advice to fix this problem by setting the output of my map to Text and IntWritiable but it has no effect. I keep getting the same response. Here is the code.

    public class WordCountGamma extends Configured implements Tool {
    public int run(String[] args) throws Exception {
    Configuration conf = new Configuration();
    Job job = new Job(conf, “wordcount”);




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

    return 0;

    public class WordCountMapper extends Mapper {
    private final static IntWritable one = new IntWritable(1);
    private Text word = new Text();

    public void map(Object key, Text value,
    OutputCollector output, Reporter reporter) throws IOException {
    String line = value.toString();
    StringTokenizer tokenizer = new StringTokenizer(line);
    while (tokenizer.hasMoreTokens()) {
    output.collect(word, one);
    public class WordCountReducer extends Reducer {
    public void reduce(Text key, Iterator values,
    OutputCollector output, Reporter reporter) throws IOException {
    int sum = 0;
    while (values.hasNext()) {
    sum +=;
    output.collect(key, new IntWritable(sum));

    I am using hadoop-core-1.2.0 and running on Hortonworks VM. What am I missing?



  • Author
  • #29964
    John Brinnand

    Okay – folks. I found the error. It was a library incompatibility. This issue is resolved.


    Hi John,

    thanks for letting us know that you found and fixed the issue.


The topic ‘Web App mapreduce job failing’ is closed to new replies.

Support from the Experts

A HDP Support Subscription connects you experts with deep experience running Apache Hadoop in production, at-scale on the most demanding workloads.

Enterprise Support »

Become HDP Certified

Real world training designed by the core architects of Hadoop. Scenario-based training courses are available in-classroom or online from anywhere in the world

Training »

Hortonworks Data Platform
The Hortonworks Data Platform is a 100% open source distribution of Apache Hadoop that is truly enterprise grade having been built, tested and hardened with enterprise rigor.
Get started with Sandbox
Hortonworks Sandbox is a self-contained virtual machine with Apache Hadoop pre-configured alongside a set of hands-on, step-by-step Hadoop tutorials.
Modern Data Architecture
Tackle the challenges of big data. Hadoop integrates with existing EDW, RDBMS and MPP systems to deliver lower cost, higher capacity infrastructure.