MapReduce在集群执行任务时报错:Initialization of all the collectors failed. Error in last collector was:java.lang.ClassCastException
报错信息详细:
Error: java.io.IOException: Initialization of all the collectors failed. Error in last collector was:java.lang.ClassCastException:
class com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$Text at org.apache.hadoop.mapred.MapTask.createSortingCollector(MapTask.java:423) at org.apache.hadoop.mapred.MapTask.access$100(MapTask.java:82) at org.apache.hadoop.mapred.MapTask$NewOutputCollector.<init>(MapTask.java:710) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:782) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:347) at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:174) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1730) at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:168
仔细看以下这个信息: java.lang.ClassCastException:class com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$Text
ClassCastException:类转换异常,查找了自己写的代码,果然在Runner类里发现了导入的包错了。
修改成hadoop下的包:import org.apache.hadoop.io.Text;
修改完成后成功执行
唯有热爱方能抵御岁月漫长。