运行map reduce job时出错:org / jdom / JDOMException

时间:2013-04-01 19:18:32

标签: java hadoop xml-parsing mapreduce jdom

您好我正在尝试使用map reduce框架解析XML文件。我正在使用JDOM Parser来解析XML文件。但是当我在伪节点集群上运行我的map reduce代码时,它会导致我跟踪错误。

WARN mapred.JobClient: Use GenericOptionsParser for parsing the arguments. Applications  
                       should implement Tool for the same.
INFO input.FileInputFormat: Total input paths to process : 1
INFO util.NativeCodeLoader: Loaded the native-hadoop library
WARN snappy.LoadSnappy: Snappy native library not loaded
INFO mapred.JobClient: Running job: job_201303281220_0016
INFO mapred.JobClient: map 0% reduce 0%
INFO mapred.JobClient: Task Id : attempt_201303281220_0016_m_000000_0, Status : FAILED
Error: org/jdom/JDOMException
INFO mapred.JobClient: Task Id : attempt_201303281220_0016_m_000000_1, Status : FAILED
Error: org/jdom/JDOMException
INFO mapred.JobClient: Task Id : attempt_201303281220_0016_m_000000_2, Status : FAILED
Error: org/jdom/JDOMException
INFO mapred.JobClient: Job complete: job_201303281220_0016
INFO mapred.JobClient: Counters: 7
INFO mapred.JobClient: Job Counters
INFO mapred.JobClient: SLOTS_MILLIS_MAPS=7541
INFO mapred.JobClient: Total time spent by all reduces waiting after reserving slots  
                       (ms)=0
INFO mapred.JobClient: Total time spent by all maps waiting after reserving slots 
                       (ms)=0
INFO mapred.JobClient: Launched map tasks=4
INFO mapred.JobClient: Data-local map tasks=4
INFO mapred.JobClient: SLOTS_MILLIS_REDUCES=0
INFO mapred.JobClient: Failed map tasks=1

我尝试下载JDOM 1.x jar但仍无法获得相同的错误。如果有人可以提出一些有用的建议。

注意:我能够运行各种示例,如字数统计,PI,所以我认为我的集群正确建立。

提前致谢。

1 个答案:

答案 0 :(得分:0)

您需要确认并确保输入文件每行有一个XML文档(例如,XML中没有换行符)? map()方法很可能是单行传递的(你使用的是FileInputFormat),但是嵌入的换行符这些行只包含部分XML文档。

例如,如果您的文件如下所示:

<root
    arg1=""
    arg2="">

</root>

然后将为五行中的每一行调用一次map()方法。这些行都不包含有效的XML文档。即使您的文件确实包含有效的XML

,也会抛出DOM解析错误5次