Monday, 21 April 2014

[SOLVED] java.lang.Exception: java.lang.ClassCastException: class com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$Text




It is quite natural seeing ClassCastException in Hadoop MR Jobs like these for Hadoop beginers.

java.lang.Exception: java.lang.ClassCastException: class com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$Text
 at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:404)
Caused by: java.lang.ClassCastException: class com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$Text
 at java.lang.Class.asSubclass(Class.java:3037)
 at org.apache.hadoop.mapred.JobConf.getOutputKeyComparator(JobConf.java:819)
 at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.init(MapTask.java:836)
 at org.apache.hadoop.mapred.MapTask.createSortingCollector(MapTask.java:376)
 at org.apache.hadoop.mapred.MapTask.access$100(MapTask.java:85)
 at org.apache.hadoop.mapred.MapTask$NewOutputCollector.<init>(MapTask.java:584)
 at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:656)
 at org.apache.hadoop.mapred.MapTask.run(MapTask.java:330)
 at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:266)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
 at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
 at java.util.concurrent.FutureTask.run(FutureTask.java:166)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
 at java.lang.Thread.run(Thread.java:722)

While checking MR code we will not find any errors,but causes a ClassCastException

When Eclipse detects a problem in your code, it will display an error or warning icon along the left edge - known as gutter. Hover over the icon, a description of the problem pops up.  And imports the wrong statement and runs the job.





It is because we are importing the wrong import statement by mistake.





 Correct import statement is 


Now MR job executes with no exception

Happy Hadooping 





19 comments:

  1. Thank you so much for sharing this worthwhile to spent time on. You are running a really awesome blog. Keep up this good work

    Hadoop training velachery
    Hadoop training in velachery
    Big data training in velachery

    ReplyDelete
  2. Learning new technology would give oneself a true confidence in the current emerging Information Technology domain. With the knowledge of big data the most magnificent cloud computing technology one can go the peek of data processing. As there is a drastic improvement in this field everyone are showing much interest in pursuing this technology. Your content tells the same about evolving technology. Thanks for sharing this.

    Hadoop Training in Chennai | Best hadoop training institute in chennai | Big Data Hadoop Training in Chennai | Hadoop Course in Chennai

    ReplyDelete
  3. 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 training institutes in chennai | Manual testing training in Chennai

    ReplyDelete
  4. There is a huge demand for professional big data analysts who are able to use the software which is used to process the big data in order to get accurate results. MNC's are looking for professionals who can process their data so that they can get into a accurate business decision which would eventually help them to earn more profits, they can serve their customers better, and their risk is lowered.
    big data training in chennai|big data training|big data course in chennai|big data training chennai|big data hadoop training in chennai

    ReplyDelete

  5. Thanks for sharing, I will bookmark and be back again

    Hadoop Certification in Chennai

    ReplyDelete
  6. Thank you so much for sharing this worthwhile to spent time on. You are running a really awesome blog. Keep up this good work
    Hadoop-Big-Data-Administration

    ReplyDelete
  7. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information&its very useful to me...
    Android training in chennai
    Ios training in chennai

    ReplyDelete
  8. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site. Best Java Training Institute in chennai

    ReplyDelete
  9. The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.

    ccna training in chennai



    ccna training in bangalore


    ccna training in pune

    ReplyDelete
  10. Well done! Pleasant post! This truly helps me to discover the solutions for my inquiry. Trusting, that you will keep posting articles having heaps of valuable data. You're the best! 
    java training in chennai | java training in bangalore

    java online training | java training in pune

    selenium training in chennai

    selenium training in bangalore

    ReplyDelete
  11. Awesome..You have clearly explained …Its very useful for me to know about new things..Keep on blogging..
    java training in marathahalli | java training in btm layout

    java training in rajaji nagar | java training in jayanagar

    ReplyDelete