Apache Nutch:FetcherJob 在 Gora 深处抛出 NoSuchElementException
Apache Nutch: FetcherJob throws NoSuchElementException deep in Gora
我是 运行 Apache Nutch 2.3.1 开箱即用,它使用 Gora 0.6.1。我已按照此处的说明进行操作:http://wiki.apache.org/nutch/RunNutchInEclipse
它运行 和InjectorJob
没问题。
现在我是 运行 FetcherJob
,Gora 使用 MemStore
作为数据存储。我有 gora.properties
包含
gora.datastore.default=org.apache.gora.memory.store.MemStore
这抛出:
2016-10-02 22:55:54,605 ERROR mapreduce.GoraRecordReader (GoraRecordReader.java:nextKeyValue(121)) - Error reading Gora records: null
2016-10-02 22:55:54,605 INFO mapred.MapTask (MapTask.java:flush(1460)) - Starting flush of map output
2016-10-02 22:55:54,614 INFO mapred.LocalJobRunner (LocalJobRunner.java:runTasks(456)) - map task executor complete.
2016-10-02 22:55:54,615 WARN mapred.LocalJobRunner (LocalJobRunner.java:run(560)) - job_local874667143_0001
java.lang.Exception: java.lang.RuntimeException: java.util.NoSuchElementException
at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:462)
at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:522)
Caused by: java.lang.RuntimeException: java.util.NoSuchElementException
at org.apache.gora.mapreduce.GoraRecordReader.nextKeyValue(GoraRecordReader.java:122)
at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.nextKeyValue(MapTask.java:556)
at org.apache.hadoop.mapreduce.task.MapContextImpl.nextKeyValue(MapContextImpl.java:80)
at org.apache.hadoop.mapreduce.lib.map.WrappedMapper$Context.nextKeyValue(WrappedMapper.java:91)
at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:243)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.NoSuchElementException
at java.util.concurrent.ConcurrentSkipListMap.firstKey(ConcurrentSkipListMap.java:2036)
at org.apache.gora.memory.store.MemStore.execute(MemStore.java:128)
at org.apache.gora.query.impl.QueryBase.execute(QueryBase.java:73)
at org.apache.gora.mapreduce.GoraRecordReader.executeQuery(GoraRecordReader.java:67)
at org.apache.gora.mapreduce.GoraRecordReader.nextKeyValue(GoraRecordReader.java:109)
... 12 more
2016-10-02 22:55:55,383 INFO mapreduce.Job (Job.java:monitorAndPrintJob(1360)) - Job job_local874667143_0001 running in uber mode : false
2016-10-02 22:55:55,385 INFO mapreduce.Job (Job.java:monitorAndPrintJob(1367)) - map 0% reduce 0%
2016-10-02 22:55:55,387 INFO mapreduce.Job (Job.java:monitorAndPrintJob(1380)) - Job job_local874667143_0001 failed with state FAILED due to: NA
2016-10-02 22:55:55,396 INFO mapreduce.Job (Job.java:monitorAndPrintJob(1385)) - Counters: 0
Exception in thread "main" java.lang.RuntimeException: job failed: name=, jobid=job_local874667143_0001
at org.apache.nutch.util.NutchJob.waitForCompletion(NutchJob.java:119)
at org.apache.nutch.fetcher.FetcherJob.run(FetcherJob.java:205)
at org.apache.nutch.fetcher.FetcherJob.fetch(FetcherJob.java:251)
at org.apache.nutch.fetcher.FetcherJob.run(FetcherJob.java:314)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.nutch.fetcher.FetcherJob.main(FetcherJob.java:321)
这种情况发生在 Nutch 和 Gora 的深处,我不知道为什么会这样。我尝试升级到 Gora 0.8 但同样的问题。我尝试将 Gora 降级到 0.6,同样的问题。我想切换到另一个数据存储,如 hBase,但这对我目前需要的东西来说有点过分了。
请帮我解决这个问题。
我确认问题出在 MemStore 中。
在 0.6.1 中有一个错误:
https://github.com/apache/gora/blob/apache-gora-0.6.1/gora-core/src/main/java/org/apache/gora/memory/store/MemStore.java#L128
master已经解决了:https://github.com/apache/gora/blob/master/gora-core/src/main/java/org/apache/gora/memory/store/MemStore.java#L155,访问#firstKey()有一个守卫#isEmpty()
但是,不要尝试更新到 Gora 0.7-SNAPSHOT,因为 Nutch 现在还不适应它。
编辑
如果您想将 Gora-0.7-SNAPSHOT 与 Nutch 2.x 一起使用,也许您可以这样做:
- 下载 0.7-SNAPSHOT 版本的 Gora master 分支
- 在 gora/ 中执行
mvn install
以将其安装到 maven 的本地存储库中
- 将此补丁应用于 Nutch:https://paste.apache.org/jjqz 因此 Nutch 2.3.1 将与 Gora 0.7-SNAPSHOT 一起工作
- 学习 Nutch 的教程
希望有用:)
编辑 2
关于HBase的使用,本地安装实验还是很简单的。
- 如Nutch2Tutorial, download HBase 0.98.8-hadoop2
所述
- 扩充目录中的tar.gz文件,例如:
/home/you/hbase
cd /home/you/hbase/bin
./start-hbase.sh
现在你已经启动了 HBase&运行。
配置 Nutch:
ivy/ivy.xml:
看@Emmanuel关于HBase的ivy依赖配置的评论
gora.properties:
gora.datastore.default=org.apache.gora.hbase.store.HBaseStore
gora.datastore.autocreateschema=true
gora.datastore.scanner.caching=100
nutch-site.xml:
<configuration>
<property>
<name>storage.data.store.class</name>
<value>org.apache.gora.hbase.store.HBaseStore</value>
<description>Default class for storing data</description>
</property>
</configuration>
完成。它将采用 HBase 的所有默认配置:localhost、/tmp/...、blablabla
我是 运行 Apache Nutch 2.3.1 开箱即用,它使用 Gora 0.6.1。我已按照此处的说明进行操作:http://wiki.apache.org/nutch/RunNutchInEclipse
它运行 和InjectorJob
没问题。
现在我是 运行 FetcherJob
,Gora 使用 MemStore
作为数据存储。我有 gora.properties
包含
gora.datastore.default=org.apache.gora.memory.store.MemStore
这抛出:
2016-10-02 22:55:54,605 ERROR mapreduce.GoraRecordReader (GoraRecordReader.java:nextKeyValue(121)) - Error reading Gora records: null
2016-10-02 22:55:54,605 INFO mapred.MapTask (MapTask.java:flush(1460)) - Starting flush of map output
2016-10-02 22:55:54,614 INFO mapred.LocalJobRunner (LocalJobRunner.java:runTasks(456)) - map task executor complete.
2016-10-02 22:55:54,615 WARN mapred.LocalJobRunner (LocalJobRunner.java:run(560)) - job_local874667143_0001
java.lang.Exception: java.lang.RuntimeException: java.util.NoSuchElementException
at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:462)
at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:522)
Caused by: java.lang.RuntimeException: java.util.NoSuchElementException
at org.apache.gora.mapreduce.GoraRecordReader.nextKeyValue(GoraRecordReader.java:122)
at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.nextKeyValue(MapTask.java:556)
at org.apache.hadoop.mapreduce.task.MapContextImpl.nextKeyValue(MapContextImpl.java:80)
at org.apache.hadoop.mapreduce.lib.map.WrappedMapper$Context.nextKeyValue(WrappedMapper.java:91)
at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:243)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.NoSuchElementException
at java.util.concurrent.ConcurrentSkipListMap.firstKey(ConcurrentSkipListMap.java:2036)
at org.apache.gora.memory.store.MemStore.execute(MemStore.java:128)
at org.apache.gora.query.impl.QueryBase.execute(QueryBase.java:73)
at org.apache.gora.mapreduce.GoraRecordReader.executeQuery(GoraRecordReader.java:67)
at org.apache.gora.mapreduce.GoraRecordReader.nextKeyValue(GoraRecordReader.java:109)
... 12 more
2016-10-02 22:55:55,383 INFO mapreduce.Job (Job.java:monitorAndPrintJob(1360)) - Job job_local874667143_0001 running in uber mode : false
2016-10-02 22:55:55,385 INFO mapreduce.Job (Job.java:monitorAndPrintJob(1367)) - map 0% reduce 0%
2016-10-02 22:55:55,387 INFO mapreduce.Job (Job.java:monitorAndPrintJob(1380)) - Job job_local874667143_0001 failed with state FAILED due to: NA
2016-10-02 22:55:55,396 INFO mapreduce.Job (Job.java:monitorAndPrintJob(1385)) - Counters: 0
Exception in thread "main" java.lang.RuntimeException: job failed: name=, jobid=job_local874667143_0001
at org.apache.nutch.util.NutchJob.waitForCompletion(NutchJob.java:119)
at org.apache.nutch.fetcher.FetcherJob.run(FetcherJob.java:205)
at org.apache.nutch.fetcher.FetcherJob.fetch(FetcherJob.java:251)
at org.apache.nutch.fetcher.FetcherJob.run(FetcherJob.java:314)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.nutch.fetcher.FetcherJob.main(FetcherJob.java:321)
这种情况发生在 Nutch 和 Gora 的深处,我不知道为什么会这样。我尝试升级到 Gora 0.8 但同样的问题。我尝试将 Gora 降级到 0.6,同样的问题。我想切换到另一个数据存储,如 hBase,但这对我目前需要的东西来说有点过分了。
请帮我解决这个问题。
我确认问题出在 MemStore 中。
在 0.6.1 中有一个错误: https://github.com/apache/gora/blob/apache-gora-0.6.1/gora-core/src/main/java/org/apache/gora/memory/store/MemStore.java#L128
master已经解决了:https://github.com/apache/gora/blob/master/gora-core/src/main/java/org/apache/gora/memory/store/MemStore.java#L155,访问#firstKey()有一个守卫#isEmpty()
但是,不要尝试更新到 Gora 0.7-SNAPSHOT,因为 Nutch 现在还不适应它。
编辑
如果您想将 Gora-0.7-SNAPSHOT 与 Nutch 2.x 一起使用,也许您可以这样做:
- 下载 0.7-SNAPSHOT 版本的 Gora master 分支
- 在 gora/ 中执行
mvn install
以将其安装到 maven 的本地存储库中 - 将此补丁应用于 Nutch:https://paste.apache.org/jjqz 因此 Nutch 2.3.1 将与 Gora 0.7-SNAPSHOT 一起工作
- 学习 Nutch 的教程
希望有用:)
编辑 2
关于HBase的使用,本地安装实验还是很简单的。
- 如Nutch2Tutorial, download HBase 0.98.8-hadoop2 所述
- 扩充目录中的tar.gz文件,例如:
/home/you/hbase
cd /home/you/hbase/bin
./start-hbase.sh
现在你已经启动了 HBase&运行。 配置 Nutch:
ivy/ivy.xml: 看@Emmanuel关于HBase的ivy依赖配置的评论
gora.properties:
gora.datastore.default=org.apache.gora.hbase.store.HBaseStore
gora.datastore.autocreateschema=true
gora.datastore.scanner.caching=100
nutch-site.xml:
<configuration>
<property>
<name>storage.data.store.class</name>
<value>org.apache.gora.hbase.store.HBaseStore</value>
<description>Default class for storing data</description>
</property>
</configuration>
完成。它将采用 HBase 的所有默认配置:localhost、/tmp/...、blablabla