【问题标题】:Errors when configuring Apache Nutch crawler配置 Apache Nutch 爬虫时的错误
【发布时间】:2014-08-22 13:31:50
【问题描述】:

我在 Linux 服务器上运行 Nutch 时遇到了一些问题。我正在尝试抓取在 seed.txt 中配置的 URL,但我看到了以下错误。爬虫触发如下

nohup java  -classpath "./common-conf/*:*:./plugins/*:" -jar  crawler-jar-2.0-SNAPSHOT.jar &

在此配置中,所有配置属性都存在于 common-conf 目录中。我们在 Crawler 二进制文件中设置了一些自定义配置。因此,我们构建了一个自定义二进制文件,并且不使用标准的 Apache nutch 爬虫。我看到以下问题:

  1. 我们的自定义 nutch-default.xmlnutch-site.xml 不是从 common-conf 类路径目录中选取的。它们是从 nutch jar 文件中提取的。当我打印出这两个 xml 的 URL 路径时,我看到了类似这样的内容

    nutch 默认 = jar:file:/home/nbsxlwa/crawler/lib/nutch-2.2.1.jar!/nutch-default.xml nutch 网站 = jar:file:/home/nbsxlwa/crawler/lib/nutch-2.2.1.jar!/nutch-site.xml

    我希望从类路径中提取文件。我可以验证文件是否存在。

  2. 我们的自定义 gora.properties 没有被提取。我看到以下日志跟踪

    14/08/22 07:18:24 WARN store.DataStoreFactory:找不到 gora.properties,属性将为空。 14/08/22 07:18:24 INFO crawl.InjectorJob: InjectorJob: 使用类 org.apache.gora.memory.store.MemStore 作为 Gora 存储类。

    gora.properties 存在于类路径中,我不确定为什么它没有被拾取。

    /home/nbsxlwa/crawler/ find . -name "gora.properties"
    ./common-conf/gora.properties
    
  3. http.agent.name 配置属性未被拾取。我可以确认配置存在于 nutch-site.xml 中

    堆栈跟踪如下。

    14/08/22 07:18:36 ERROR fetcher.FetcherJob: Fetcher: No agents listed in 'http.agent.name' property.
    14/08/22 07:18:36 WARN crawl.Crawler: Error running crawler job for configuration. Tool run command raises an exception
    java.lang.IllegalArgumentException: Fetcher: No agents listed in 'http.agent.name' property.
            at org.apache.nutch.fetcher.FetcherJob.checkConfiguration(FetcherJob.java:252)
            at org.apache.nutch.fetcher.FetcherJob.run(FetcherJob.java:160)
            at org.apache.nutch.crawl.Crawler.runTool(Crawler.java:78)
            at org.apache.nutch.crawl.Crawler.run(Crawler.java:176)
            at org.apache.nutch.crawl.Crawler.run(Crawler.java:266)
            at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
            at org.apache.nutch.crawl.Crawler.main(Crawler.java:356)
    
  4. regex-normalize.xmlregex-urlfilter.txt 未从类路径中获取。我可以确认这些文件存在于我的类路径中。堆栈跟踪如下所示

    /home/nbsxlwa/crawler : find . -name "regex-normalize.xml"
    ./common-conf/regex-normalize.xml
    
    /home/nbsxlwa/crawler : find . -name "regex-urlfilter.txt"
    ./common-conf/regex-urlfilter.txt
    
    
    14/08/22 07:18:29 INFO conf.Configuration: regex-normalize.xml not found
    14/08/22 07:18:29 WARN regex.RegexURLNormalizer: Can't load the default rules! 
    14/08/22 07:18:29 INFO conf.Configuration: regex-urlfilter.txt not found
    14/08/22 07:18:29 INFO conf.Configuration: regex-normalize.xml not found
    14/08/22 07:18:29 WARN regex.RegexURLNormalizer: Can't load the default rules!
    

我已经浏览了以下链接,看看我哪里出错了。如何在此处设置 Nutch 配置设置?

  1. http://mail-archives.apache.org/mod_mbox/nutch-user/201202.mbox/%3CCAGaRif3rtJHokgG5FHSbnJLLUAVGiDnfx7JaW-7kiBjx_ivwSg@mail.gmail.com%3E
  2. http://osdir.com/ml/user.nutch.apache/2012-02/msg00127.html

【问题讨论】:

    标签: java nutch web-crawler


    【解决方案1】:

    我知道这是旧的,但认为它可能会在未来帮助某人: 您是否尝试过运行: 蚂蚁运行时 更改配置值后从 nutch 文件夹中运行它。

    【讨论】:

      猜你喜欢
      • 2018-06-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多