Wednesday, July 22, 2009

Hadoop: java.io.IOException: Type mismatch in key from map

We've been working with hadoop for a while now, and inevitably newbies run into this error the first time they go to create their own Hadoop job. If you are running into this error, it is most likely a mismatch between your Map and/or Reduce implementation and the job configuration.

Your Map implementation probably looks something like this:

public static class MapClass extends MapReduceBase
implements Mapper {
private Text word = new Text();
public void map(LongWritable key, Text value,
OutputCollector output,
Reporter reporter) throws IOException {
...
}


Now, your map and reduce phases can have different output types and that is what sometimes causes the problems. If your phases are producing different types, be sure to set those types in the JobConf. You do this as follows....

Then when configuring your job you need to declare the appropriate output classes.

// Set the outputs for the Map
conf.setMapOutputKeyClass(Text.class);
conf.setMapOutputValueClass(IntWritable.class);

// Set the outputs for the Job
conf.setOutputKeyClass(Text.class);
conf.setOutputValueClass(ArrayWritable.class);


Hope that saves people some time.

98 comments:

Matt said...
This comment has been removed by the author.
Matt said...

Thanks, this solved my problem!

Aaron Zinman said...
This comment has been removed by the author.
Aaron Zinman said...

OMG I banged my head on this for too many hours! Thanks!

Djordje said...

Thanks!!!

I have been stacked so long on this on...

Mythal said...

Thanks, really help me out!

mymaydayya said...

Thanks!!!

Subhashlg26 said...

I have
Mapper with
i/p key = LongWritable value= Text
o/p key = Text value = LongWritable

Reducre with
i/p key = Text value= LongWritale
o/p key = Text value = CallReport extends Writable

job.setOutputKeyClass(Text.class);
job.setOutputValueClass(CallReport.class);
job.setMapOutputKeyClass( Text.class);
job.setMapOutputValueClass( LongWritable.class);

Still it is giving me error.
wrong value class: class com.surgent.analytics.mapreduce.CallReport is not class org.apache.hadoop.io.LongWritable

PoPoX said...

Thanks! This solved my problem.

I thought i could never work around my issue..!

Venkatesh U said...

Thanks, it solved the problem

Harshal said...

Thanks a ton, this saved a lot of time :)

manu bharghav said...

thanks.

manu bharghav said...

thanks.

nehamahajan said...

thanks it helps a lot.

sudheer said...

Thanks for this information and it is useful for Hadoop Learners.Hadoop online trainings provides best Hadoop online training.

kumar said...

Thanks for this valuble information and itis useful for us .123trainings also provides the best online Hadoop training classes.to see free demo class online Hadoop training classes in uk,canada

sudheer said...

thanks for this valuble information and itis useful for us .Hadoop online trainings also provides the best Hadoop online training classes in India.

sundara rami reddy said...

This is such a great resource on hadoop ,that you are providing and you give it away for free. I love seeing websites that understand the value of providing a quality resource for free.
Hadoop Training in hyderabad

besantvignesh M said...

Thanks a lot.i have to learn to lot of hadoop

Hadoop Training in Chennai

Aditya Pavan said...

Wow. You are a day saver. Thanks a lot!

ramya parvathaneni said...


Hi,
The best information from your blogger and we are providing online training with total modules hadoop online training

Hadoop online training said...

Hi,
The best information and we are providing online training with all modules
hadoop online training
with real time

christina jeni said...

Thanks for sharing this informative blog. If anyone wants to get Hadoop Training in Chennai visit fita academy located at Chennai, which offers best Big Data Training in Chennai with years of experienced professionals.

Stephen said...

Hi brian, nice article on collaborating hadoop and java. Since I have quite knowledge in Java this will be helpful for me to undergo Hadoop Course in Chennai

Emi Jackson said...

Your blog is really useful for me. Thanks for sharing this informative blog. If anyone wants to get real time Oracle Training in Chennai reach FITA located at Chennai. They give professional and job oriented training for all students.

Victoria John said...

Hi I am Victoria lives in Chennai. I am a technology freak. Recently I did Java Training in Chennai at a leading Java Training Institutes in Chennai. This is really helpful for me to make a bright carrer in IT industry.

Victoria John said...

Thanks for sharing this informative blog..If anyone wants to get SAP ABAP Training in Chennai, please visit FITA Academy located at Chennai, rated as No.1 SAP Training Center in Chennai.


john son said...

Dot Net Training Chennai

Thanks for your wonderful post.It is really very helpful for us and I have gathered some important information from this blog.If anyone wants to get Dot Net Training in Chennai reach FITA, rated as No.1 Dot Net Training Institute in Chennai.

Dot Net Course in Chennai


Victoria John said...

Salesforce Training

The information you posted here is useful to make my career better keep updates..I did Salesforce Training in Chennai at FITA academy. Its really useful for me to make bright future in IT industry.

Salesforce Developer Training in Chennai

Salesforce Administrator Training in Chennai

Salesforce.com Training in Chennai

Sales Cloud Consultant Training in Chennai

rebeka christy said...

PHP Training in Velachery

I get a lot of great information from this blog. Thank you for your sharing this informative blog. Recently I did PHP course at a leading academy. If you are looking for best PHP Training Center in Chennai visit FITA IT training academy which offer real timePHP Training in Chennai.

PHP Course in Chennai

christina jeni said...

Oracle Training Chennai

I get a lot of great information from this blog. Recently I did oracle certification course at a leading academy. If anyone interested to learn best Oracle Course in Chennai visit FITA academy which offer SQL Training in Chennai.

Regards...

Oracle Training in Chennai


jack wilson said...

Testing Training in Chennai

Its really awesome blog..If anyone wants to get Automation Training in Chennai visit FITA IT academy located at Chennai. Rated as No.1 Software Testing Training Institutes in Chennai

Software Testing Course in Chennai

jack wilson said...

QTP Training Chennai

Hi, I wish to be a regular contributor of your blog. I have read your blog. Your information is really useful for beginner. I did Software Testing Course in Chennai at Fita training and placement academy which offer best Software Testing Training in Chennai with years of experienced professionals. This is really useful for me to make a bright career.

Regards...

Software Testing Training Institutes in Chennai

jhansi joe said...

I have read your blog it was nice to follow even I am looking for your future updates. Hadoop is a highly growing & scoopful technology in IT market it’s an open-source software framework for managing big data in a distributed fashion on large commodity computing hardware. FITA provides Hadoop training chennai get in to fita and out with your career.
Hadoop training in chennai | Hadoop courses in Chennai | Hadoop institutes in Chennai

Emi Jackson said...

HTML5 Training

Hi, Thanks for sharing this valuable blog.I was really impressed by reading this blog. I did HTML5 Training in Chennai at reputed HTML5 Training Institutes in Chennai. This is really useful for me to make a bright future in designing field.

Best HTML5 Training in Chennai

Suranka VMware said...

Your posts is really helpful for me.Thanks for your wonderful post. I am very happy to read your post.

VMWare course chennai | VMWare certification in chennai | VMWare certification chennai

dhanamlakshmi palu said...

Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.Nice article i was really impressed by seeing this article, it was very interesting and it is very useful..AWS course chennai | AWS Certification in chennai | AWS Certification chennai

surangacloud said...

very nice blogs!!! i have to learning a lot of information for this sites...Sharing for wonderful information.I get a lot of great information from this blog. Thank you for your sharing this informative blog.
Cloud Computing Training in chennai | Cloud Computing Training chennai | Cloud Computing Course in chennai | Cloud Computing Course chennai

Kalyan Hadoop said...

Best Big Data Hadoop Training in Hyderabad @ Kalyan Orienit

Follow the below links to know more knowledge on Hadoop

WebSites:
================
http://www.kalyanhadooptraining.com/

http://www.hyderabadhadooptraining.com/

http://www.bigdatatraininghyderabad.com/

Videos:
===============
https://www.youtube.com/watch?v=-_fTzrgzVQc

https://www.youtube.com/watch?v=Df2Odze87dE

https://www.youtube.com/watch?v=AOfX-tNkYyo

https://www.youtube.com/watch?v=Cyo3y0vlZ3c

https://www.youtube.com/watch?v=jOLSXx6koO4

https://www.youtube.com/watch?v=09mpbNBAmCo

Kalyan Hadoop said...

Best Big Data Hadoop Training in Hyderabad @ Kalyan Orienit

Follow the below links to know more knowledge on Hadoop

WebSites:
================
http://www.kalyanhadooptraining.com/

http://www.hyderabadhadooptraining.com/

http://www.bigdatatraininghyderabad.com/

Videos:
===============
https://www.youtube.com/watch?v=-_fTzrgzVQc

https://www.youtube.com/watch?v=Df2Odze87dE

https://www.youtube.com/watch?v=AOfX-tNkYyo

https://www.youtube.com/watch?v=Cyo3y0vlZ3c

https://www.youtube.com/watch?v=jOLSXx6koO4

https://www.youtube.com/watch?v=09mpbNBAmCo

Kalyan Hadoop said...

Best Big Data Hadoop Training in Hyderabad @ Kalyan Orienit

Follow the below links to know more knowledge on Hadoop

WebSites:
================
http://www.kalyanhadooptraining.com/

http://www.hyderabadhadooptraining.com/

http://www.bigdatatraininghyderabad.com/

Videos:
===============
https://www.youtube.com/watch?v=-_fTzrgzVQc

https://www.youtube.com/watch?v=Df2Odze87dE

https://www.youtube.com/watch?v=AOfX-tNkYyo

https://www.youtube.com/watch?v=Cyo3y0vlZ3c

https://www.youtube.com/watch?v=jOLSXx6koO4

https://www.youtube.com/watch?v=09mpbNBAmCo

jack wilson said...

I get a lot of great information from this blog. Thank you for your sharing this informative blog. Just now I have completed hadoop certification course at a leading academy. If you are interested to learn Hadoop Training Chennai visit FITA IT training and placement academy.

Ranjitha M said...

Thanks for your informative sharing blog. And i got a lot of information from this blog.
online marketing course in chennai

john son said...

Hi friends,This is Johnson from Chennai.Thanks for sharing this informative blog. I did Unix certification course in Chennai at Fita academy. This is really useful for me to make a bright career.
Regards..
Unix Training Chennai

Mohamed Omer said...

Nice and Best article on Hadoop. Got to learn and know more about this. for more information to can see this online site for better understandability with more points of info

peterjohn said...

I appreciate you sharing this article. Really thank you! Much obliged.
This is one awesome blog article. Much thanks again.


regards
sap sd online training

peterjohn said...

Pretty good post. I just came across your site and wanted to say that I’ve really enjoyed reading your posts. In any case I’ll be subscribing to your feed and I hope you will keep a good work!Cheer!


Regards
hadoop online training

syed s said...

I was reading your blog this morning and noticed that you have a awesome
resource page. I actually have a similar blog that might be helpful or useful
to your audience.

Regards
sap sd and crm online training
sap online tutorials
sap sd tutorial
sap sd training in ameerpet

peterjohn said...

I really enjoy the blog.Much thanks again. Really Great.
Very informative article post.Really looking forward to read more. Will read on…

sap online training
software online training
oracle online training
sap fico online training
dotnet online training
qa-qtp-software-testing-training-tutorial

sap-crm-online-training

Andrew Son said...

There are lots of information about latest technology and how to get trained in them, like Hadoop Training Chennai have spread around the web, but this is a unique one according to me. The strategy you have updated here will make me to get trained in future technologies(Hadoop Training in Chennai). By the way you are running a great blog. Thanks for sharing this (Salesforce Training in Chennai).

Nasreen Basu said...

brillant piece of information, I had come to know about your web-page from my friend hardkik, chennai,i have read atleast 9 posts of yours by now, and let me tell you, your webpage gives the best and the most interesting information. This is just the kind of information that i had been looking for, i'm already your rss reader now and i would regularly watch out for the new posts, once again hats off to you! Thanx a million once again, Regards, obiee training in hyderabad,informatica training in hyderabad


Melisa said...

I have read your blog, it was good to read & I am getting some useful info's through your blog keep sharing... Informatica is an ETL tools helps to transform your old business leads into new vision. Learn Informatica training in chennai from corporate professionals with very good experience in informatica tool.
Regards,
Best Informatica Training In Chennai|Informatica training center in Chennai

Harshita said...

A very informative post. Helped a lot, as I used it as a reference to train my students. Thanks a bunch.
HTML5 Training in T Nagar | HTML5 Training in T Nagar

Roshini RS said...

I have read your blog, it was good to read & I am getting some useful info's through your blog keep sharing... Informatica is an ETL tools helps to transform your old business leads into new vision. Learn Informatica training in chennai from corporate professionals with very good experience in informatica tool.
Regards,
Best Informatica Training In Chennai|Informatica training center in Chennai|Informatica training chennai

kits online said...

very good article ,kits online trainings provides best online training for sccm 2012,scom 2012 ,azure,aws and etc

KITS Online Training institute

Abinitio Online Training institute

Android Online Training institute

Application Packaging Online Training institute

App-V Online Training institute

Checkpoint Firewall Online Training institute

kits online said...

we ALSO PROVIDE SAP SCCM AND ORACLE course as well

Oracle DBA Online Training institute

Oracle SOA Online Training institute

SalesForce Online Training institute

SAP ABAP Online Training institute

SAP Basis Online Training institute

SAP Bw Hana Online Training institute

SAP Fico Online Training institute

Harshita said...

Hello , thank you for enlightening us with your knowledge sharing. PHP has become an inevitable part of web development, and with proper PHP training in Chennai, one can have a strong career in the web development field. We from Fita provide PHP training in Chennai with the best facilitation. Any aspiring students can join us for the best PHP training in Chennai.

kits online said...

very nice article.thanks for sharing the post...!
Ruby On Rails Training

SAP XI Training

OBIEE Training

Talend Training

PHP Training

kits online said...

nice article.Thanks for sharing the post...!
Amazon Web Server Training

Microsoft Azure Training

SCOM 2012 Training

Tableau Training

SCCM 2012 Training

Pooja Doss said...

There are lots of information about latest technology and how to get trained in them, like Best Hadoop Training In Chennai in Chennai have spread around the web, but this is a unique one according to me. The strategy you have updated here will make me to get trained in future technologies Hadoop Training in Chennai By the way you are running a great blog. Thanks for sharing this blogs..

Pooja Doss said...

I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing..
SalesForce Training in Chennai

Pooja Doss said...

Pretty article! I found some useful information in your blog, it was awesome to read,thanks for sharing this great content to my vision, keep sharing..
Unix Training In Chennai

Pooja Doss said...

This information is impressive..I am inspired with your post writing style & how continuously you describe this topic. After reading your post,thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic..
Android Training In Chennai In Chennai

Pooja Doss said...
This comment has been removed by the author.
Pooja Doss said...

SAP Training in Chennai
This post is really nice and informative. The explanation given is really comprehensive and informative..

Pooja Doss said...

Oracle Training in chennai
Thanks for sharing such a great information..Its really nice and informative..

Pooja Doss said...

Selenium Training in Chennai
Wonderful blog.. Thanks for sharing informative blog.. its very useful to me..

Pooja Doss said...

Data warehousing Training in Chennai
I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly..

Pooja Doss said...

Whatever we gathered information from the blogs, we should implement that in practically then only we can understand that exact thing clearly, but it’s no need to do it, because you have explained the concepts very well. It was crystal clear, keep sharing..
Websphere Training in Chennai

Pooja Doss said...

Oracle DBA Training in Chennai
Thanks for sharing this informative blog. I did Oracle DBA Certification in Greens Technology at Adyar. This is really useful for me to make a bright career..

jhansi joe said...

This technical post helps me to improve my skills set, thanks for this wonder article I expect your upcoming blog, so keep sharing..
Regards,
cognos Training in Chennai|cognos Training Chennai

Shashaa Tirupati said...

This is exactly what I was searching for. Awesome post. Thanks a bunch. Helped me in taking class for my students. Wish to follow your posts, keep writing! God Bless!
Shashaa
Dot Net course in Chennai | Dot Net course in Chennai | Dot Net course in Chennai

SAM said...

Thank You for sharing another useful post!
Best Regards.

Manufacturers of Tents | Tents South Africa | Tents for sale | Tents Manufacturers | Tents South Africa | Alpine Tents | Aluminium Tents | Alpine Marquee | Plastic Chair

Raksha said...

Hello Admin, thank you for the article. It has helped me during my Java training in Chennai. Fita academy is a Java training institutes in Chennai that provides training for interested students. So feel free to contact us to join our Java J2EE training institutes in Chennai.

Coy Currin said...

Thanks for share These Information. We are Providing Online Training. Datastageonlinetraining

Srishthi B said...

That is a brilliant article on dot net training in Chennai that I was searching for. Helps us a lot in referring at our dot net training institute in Chennai. Thanks a lot. Keep writing more on dot net course in Chennai, would love to follow your posts and refer to others in dot net training institutes in Chennai.

Ashwini Suresh said...

Hello admin, thank you for your informative post on hadoop training in Chennai. It helped a lot in training my students during our hadoop training Chennai sessions. We at Fita, provide big data training in Chennai for students who are interested in choosing a career in big data.

shankar said...


I really like the step by step approach to the final solution. I really like analytic functions now after reading this post. Thanks!!!

Best Software Testing Training Institute in Chennai with Placement

Susmitha Naralasetty said...

Best article
SCOM 2012 Online Training Institute

John Son said...

Hi, I am really happy to found such a helpful and fascinating post that is written in well manner. Thanks for sharing such an informative post. keep update your blog.
Regards.
Big Data Training in Chennai

sappractices said...

More than 5000 registered IT consultants and IT corporate's.

Request IT online training at www.todaycourses.com

Anna said...

Great and Useful Article.

Online Java Training

Java Online Training India

Java Online Course

Java EE course

Java EE training

Best Recommended books for Spring framework

Java Interview Questions








Java Course in Chennai

Java Online Training India

Akula Rahul said...

Jharkhand Labour Department Recruitment 2016

Thanks for author for providing amazing information in the post........

for IT the said...

Great Article
Java Online Course | Java EE Training


Java Training Institutes in Chennai | java j2ee training institutes in chennai | Java Training in Chennai | J2EE Training in Chennai | Java Course in Chennai


Java Interview Questions | Java Training Institutes | IT Technical Articles

Mathew Stephen said...

I have finally found a Worth able content to read. The way you have presented information here is quite impressive. I have bookmarked this page for future use. Thanks for sharing content like this once again. Keep sharing content like this.

Software testing training in chennai | Software testing course | Software testing training chennai

geethu said...

Great content. I really enjoyed while reading this content with useful information, keep sharing.
Hadoop Training in Chennai | Hadoop Training Chennai | FITA Velachery | FITA Academy Chennai.

Amirtha rao said...

Superb explanation & it's too clear to understand the concept as well, keep sharing admin with some updated information with right examples.
Regards,

Hadoop Training in Chennai|Big Data Training in Chennai|Fita Chennai reviews

Divit said...


Great article!!!!!This is very importent information for us.I like all content and information.I have read it.You know more about this please visit again.

Hadoop Certification in Chennai

SAM said...

Great post!!


Valves and Flanges Manufacturers | Flanges Manufacturer | Flanges Exporter | Falcon Engineers

Divit said...

Hey, thanks for that great investigation work on biosilk, i've been using it for some time now but always wondered what was in it. I don't see why our whores would smell worse than yours though.


Chennai Bigdata Training

Arjun kumar said...
This comment has been removed by the author.
Arjun kumar said...

Excellent article. Hadoop is a cloud based tool.It give more information about massive storage and it helps to improve our skills. Hadoop provides more job opportunities.To achieve a great career join with us.Hadoop Training Chennai|Big Data Training Chennai
Regards,
Arjun

Bay Max said...

I have completely read your post and the content is so clear about Hadoop courses.Update regularly.
Thanks
Hadoop Training chennai | Hadoop Training in chennai

Bay Max said...

I got some useful from your blog.Thanks for sharing.
Regards,
Software Testing Training | Automation Training in chennai | Software Training

mary Brown said...

Java Articles | IT Technical Articles | Dot Net Framework Articles |
JavaScript Articles | Java Training Institutes | Single Page Application Development

mary Brown said...

Java Training in Chennai
Online MVC Training India | Angularjs Training | javase j2ee javaee interview questions | Java Training in Chennai

mary Brown said...

JMS Training Institutes in Chennai | JSP Training Institutes in Chennai | Java Spring Hibernate Training Institutes in Chennai | EJB Training Institutes in Chennai | Hibernate Training Institutes in Chennai |

JSF Training Institutes in Chennai | Java EE Training Institutes in Chennai | J2EE Training Institutes in Chennai | | | | Core Java Training Institutes in Chennai | Java Training Institutes

apttree said...

very nice post......

Group exam questions and answers

Tnpsc exam questions and answers
Vao exam questions and answers