Chinaunix首页 | 论坛 | 博客
  • 博客访问: 301783
  • 博文数量: 22
  • 博客积分: 674
  • 博客等级: 上士
  • 技术积分: 792
  • 用 户 组: 普通用户
  • 注册时间: 2012-02-19 00:48
文章存档

2013年(2)

2012年(20)

我的朋友

分类: 云计算

2012-05-29 10:24:00

  在Eclipse下开发MR程序时,有时候很容易犯一些小错误甚至是低级错误,以下就是一种比较常见的错误。 java.io.IOException: Type mismatch in value from map: expected org.apache.hadoop.io.DoubleWritable, recieved org.apache.hadoop.io.Text

点击(此处)折叠或打开

  1. 2012-5-29 10:26:57 org.apache.hadoop.security.UserGroupInformation initialize
  2. 信息: JAAS Configuration already set up for Hadoop, not re-installing.
  3. 2012-5-29 10:26:58 org.apache.hadoop.mapreduce.lib.input.FileInputFormat listStatus
  4. 信息: Total input paths to process : 1
  5. 2012-5-29 10:26:58 org.apache.hadoop.util.NativeCodeLoader
  6. 警告: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
  7. 2012-5-29 10:26:58 org.apache.hadoop.io.compress.snappy.LoadSnappy
  8. 警告: Snappy native library not loaded
  9. 2012-5-29 10:26:58 org.apache.hadoop.mapred.JobClient monitorAndPrintJob
  10. 信息: Running job: job_201205242029_0035
  11. 2012-5-29 10:26:59 org.apache.hadoop.mapred.JobClient monitorAndPrintJob
  12. 信息: map 0% reduce 0%
  13. 2012-5-29 10:27:06 org.apache.hadoop.mapred.JobClient monitorAndPrintJob
  14. 信息: Task Id : attempt_201205242029_0035_m_000001_0, Status : FAILED
  15. java.io.IOException: Type mismatch in value from map: expected org.apache.hadoop.io.DoubleWritable, recieved org.apache.hadoop.io.Text
  16. at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:876)
  17. at org.apache.hadoop.mapred.MapTask$NewOutputCollector.write(MapTask.java:574)
  18. at org.apache.hadoop.mapreduce.TaskInputOutputContext.write(TaskInputOutputContext.java:80)
  19. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:30)
  20. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:1)
  21. at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
  22. at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:647)
  23. at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
  24. at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
  25. at java.security.AccessController.doPrivileged(Native Method)
  26. at javax.security.auth.Subject.doAs(Subject.java:396)
  27. at org.apache.hadoop.security.UserGroupInformation.doAs(UserGro
  28. 2012-5-29 10:27:06 org.apache.hadoop.mapred.JobClient monitorAndPrintJob
  29. 信息: Task Id : attempt_201205242029_0035_m_000003_0, Status : FAILED
  30. java.io.IOException: Type mismatch in value from map: expected org.apache.hadoop.io.DoubleWritable, recieved org.apache.hadoop.io.Text
  31. at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:876)
  32. at org.apache.hadoop.mapred.MapTask$NewOutputCollector.write(MapTask.java:574)
  33. at org.apache.hadoop.mapreduce.TaskInputOutputContext.write(TaskInputOutputContext.java:80)
  34. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:30)
  35. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:1)
  36. at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
  37. at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:647)
  38. at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
  39. at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
  40. at java.security.AccessController.doPrivileged(Native Method)
  41. at javax.security.auth.Subject.doAs(Subject.java:396)
  42. at org.apache.hadoop.security.UserGroupInformation.doAs(UserGro
  43. 2012-5-29 10:27:08 org.apache.hadoop.mapred.JobClient monitorAndPrintJob
  44. 信息: Task Id : attempt_201205242029_0035_m_000002_0, Status : FAILED
  45. java.io.IOException: Type mismatch in value from map: expected org.apache.hadoop.io.DoubleWritable, recieved org.apache.hadoop.io.Text
  46. at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:876)
  47. at org.apache.hadoop.mapred.MapTask$NewOutputCollector.write(MapTask.java:574)
  48. at org.apache.hadoop.mapreduce.TaskInputOutputContext.write(TaskInputOutputContext.java:80)
  49. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:30)
  50. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:1)
  51. at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
  52. at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:647)
  53. at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
  54. at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
  55. at java.security.AccessController.doPrivileged(Native Method)
  56. at javax.security.auth.Subject.doAs(Subject.java:396)
  57. at org.apache.hadoop.security.UserGroupInformation.doAs(UserGro
  58. 2012-5-29 10:27:10 org.apache.hadoop.mapred.JobClient monitorAndPrintJob
  59. 信息: map 10% reduce 0%
  60. 2012-5-29 10:27:12 org.apache.hadoop.mapred.JobClient monitorAndPrintJob
  61. 信息: Task Id : attempt_201205242029_0035_m_000003_1, Status : FAILED
  62. java.io.IOException: Type mismatch in value from map: expected org.apache.hadoop.io.DoubleWritable, recieved org.apache.hadoop.io.Text
  63. at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:876)
  64. at org.apache.hadoop.mapred.MapTask$NewOutputCollector.write(MapTask.java:574)
  65. at org.apache.hadoop.mapreduce.TaskInputOutputContext.write(TaskInputOutputContext.java:80)
  66. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:30)
  67. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:1)
  68. at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
  69. at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:647)
  70. at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
  71. at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
  72. at java.security.AccessController.doPrivileged(Native Method)
  73. at javax.security.auth.Subject.doAs(Subject.java:396)
  74. at org.apache.hadoop.security.UserGroupInformation.doAs(UserGro
  75. 2012-5-29 10:27:12 org.apache.hadoop.mapred.JobClient monitorAndPrintJob
  76. 信息: Task Id : attempt_201205242029_0035_m_000001_1, Status : FAILED
  77. java.io.IOException: Type mismatch in value from map: expected org.apache.hadoop.io.DoubleWritable, recieved org.apache.hadoop.io.Text
  78. at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:876)
  79. at org.apache.hadoop.mapred.MapTask$NewOutputCollector.write(MapTask.java:574)
  80. at org.apache.hadoop.mapreduce.TaskInputOutputContext.write(TaskInputOutputContext.java:80)
  81. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:30)
  82. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:1)
  83. at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
  84. at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:647)
  85. at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
  86. at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
  87. at java.security.AccessController.doPrivileged(Native Method)
  88. at javax.security.auth.Subject.doAs(Subject.java:396)
  89. at org.apache.hadoop.security.UserGroupInformation.doAs(UserGro
  90. 2012-5-29 10:27:13 org.apache.hadoop.mapred.JobClient monitorAndPrintJob
  91. 信息: map 16% reduce 0%
  92. 2012-5-29 10:27:13 org.apache.hadoop.mapred.JobClient monitorAndPrintJob
  93. 信息: Task Id : attempt_201205242029_0035_m_000002_1, Status : FAILED
  94. java.io.IOException: Type mismatch in value from map: expected org.apache.hadoop.io.DoubleWritable, recieved org.apache.hadoop.io.Text
  95. at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:876)
  96. at org.apache.hadoop.mapred.MapTask$NewOutputCollector.write(MapTask.java:574)
  97. at org.apache.hadoop.mapreduce.TaskInputOutputContext.write(TaskInputOutputContext.java:80)
  98. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:30)
  99. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:1)
  100. at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
  101. at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:647)
  102. at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
  103. at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
  104. at java.security.AccessController.doPrivileged(Native Method)
  105. at javax.security.auth.Subject.doAs(Subject.java:396)
  106. at org.apache.hadoop.security.UserGroupInformation.doAs(UserGro
  107. 2012-5-29 10:27:16 org.apache.hadoop.mapred.JobClient monitorAndPrintJob
  108. 信息: Task Id : attempt_201205242029_0035_m_000000_0, Status : FAILED
  109. java.io.IOException: Type mismatch in value from map: expected org.apache.hadoop.io.DoubleWritable, recieved org.apache.hadoop.io.Text
  110. at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:876)
  111. at org.apache.hadoop.mapred.MapTask$NewOutputCollector.write(MapTask.java:574)
  112. at org.apache.hadoop.mapreduce.TaskInputOutputContext.write(TaskInputOutputContext.java:80)
  113. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:30)
  114. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:1)
  115. at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
  116. at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:647)
  117. at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
  118. at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
  119. at java.security.AccessController.doPrivileged(Native Method)
  120. at javax.security.auth.Subject.doAs(Subject.java:396)
  121. at org.apache.hadoop.security.UserGroupInformation.doAs(UserGro
  122. 2012-5-29 10:27:17 org.apache.hadoop.mapred.JobClient monitorAndPrintJob
  123. 信息: map 0% reduce 0%
  124. 2012-5-29 10:27:18 org.apache.hadoop.mapred.JobClient monitorAndPrintJob
  125. 信息: Task Id : attempt_201205242029_0035_m_000001_2, Status : FAILED
  126. java.io.IOException: Type mismatch in value from map: expected org.apache.hadoop.io.DoubleWritable, recieved org.apache.hadoop.io.Text
  127. at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:876)
  128. at org.apache.hadoop.mapred.MapTask$NewOutputCollector.write(MapTask.java:574)
  129. at org.apache.hadoop.mapreduce.TaskInputOutputContext.write(TaskInputOutputContext.java:80)
  130. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:30)
  131. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:1)
  132. at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
  133. at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:647)
  134. at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
  135. at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
  136. at java.security.AccessController.doPrivileged(Native Method)
  137. at javax.security.auth.Subject.doAs(Subject.java:396)
  138. at org.apache.hadoop.security.UserGroupInformation.doAs(UserGro
  139. 2012-5-29 10:27:18 org.apache.hadoop.mapred.JobClient monitorAndPrintJob
  140. 信息: Task Id : attempt_201205242029_0035_m_000002_2, Status : FAILED
  141. java.io.IOException: Type mismatch in value from map: expected org.apache.hadoop.io.DoubleWritable, recieved org.apache.hadoop.io.Text
  142. at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:876)
  143. at org.apache.hadoop.mapred.MapTask$NewOutputCollector.write(MapTask.java:574)
  144. at org.apache.hadoop.mapreduce.TaskInputOutputContext.write(TaskInputOutputContext.java:80)
  145. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:30)
  146. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:1)
  147. at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
  148. at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:647)
  149. at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
  150. at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
  151. at java.security.AccessController.doPrivileged(Native Method)
  152. at javax.security.auth.Subject.doAs(Subject.java:396)
  153. at org.apache.hadoop.security.UserGroupInformation.doAs(UserGro
  154. 2012-5-29 10:27:18 org.apache.hadoop.mapred.JobClient monitorAndPrintJob
  155. 信息: Task Id : attempt_201205242029_0035_m_000003_2, Status : FAILED
  156. java.io.IOException: Type mismatch in value from map: expected org.apache.hadoop.io.DoubleWritable, recieved org.apache.hadoop.io.Text
  157. at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:876)
  158. at org.apache.hadoop.mapred.MapTask$NewOutputCollector.write(MapTask.java:574)
  159. at org.apache.hadoop.mapreduce.TaskInputOutputContext.write(TaskInputOutputContext.java:80)
  160. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:30)
  161. at com.loogn.hadoop.practice.AverageByAttribute$AverageByAttributeMapper.map(AverageByAttribute.java:1)
  162. at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
  163. at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:647)
  164. at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
  165. at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
  166. at java.security.AccessController.doPrivileged(Native Method)
  167. at javax.security.auth.Subject.doAs(Subject.java:396)
  168. at org.apache.hadoop.security.UserGroupInformation.doAs(UserGro
  169. 2012-5-29 10:27:24 org.apache.hadoop.mapred.JobClient monitorAndPrintJob
  170. 信息: Job complete: job_201205242029_0035
  171. 2012-5-29 10:27:24 org.apache.hadoop.mapred.Counters log
  172. 信息: Counters: 8
  173. 2012-5-29 10:27:24 org.apache.hadoop.mapred.Counters log
  174. 信息: Job Counters
  175. 2012-5-29 10:27:24 org.apache.hadoop.mapred.Counters log
  176. 信息: SLOTS_MILLIS_MAPS=85914
  177. 2012-5-29 10:27:24 org.apache.hadoop.mapred.Counters log
  178. 信息: Total time spent by all reduces waiting after reserving slots (ms)=0
  179. 2012-5-29 10:27:24 org.apache.hadoop.mapred.Counters log
  180. 信息: Total time spent by all maps waiting after reserving slots (ms)=0
  181. 2012-5-29 10:27:24 org.apache.hadoop.mapred.Counters log
  182. 信息: Rack-local map tasks=7
  183. 2012-5-29 10:27:24 org.apache.hadoop.mapred.Counters log
  184. 信息: Launched map tasks=14
  185. 2012-5-29 10:27:24 org.apache.hadoop.mapred.Counters log
  186. 信息: Data-local map tasks=7
  187. 2012-5-29 10:27:24 org.apache.hadoop.mapred.Counters log
  188. 信息: SLOTS_MILLIS_REDUCES=0
  189. 2012-5-29 10:27:24 org.apache.hadoop.mapred.Counters log
  190. 信息: Failed map tasks=1
  之所以会出现这样的情况,这主要是因为程序中设置map输出格式的时候出了问题,如:

点击(此处)折叠或打开

  1. job.setOutputKeyClass(Text.class);
  2. job.setOutputValueClass(DoubleWritable.class);
  在自定义mapper类中,输出格式是Text,所以与预期的DoubleWritable相悖,所以解决这样问题的方法是只需要将上面的第二行代码改为job.setOutputValueClass(Text.class)即可!
  出现这样的问题的主要原因是,没有搞清楚job.setOutputKeyClass和job.setOutputValueClass的意思,有的人会认为这是设置Reducer的输出格式,而其实是设置Map输出键值格式!
阅读(1962) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~