nutch2.1+ solr4.5 遇到的一个问题

最近搭建nutch和solr,nutch运行时用-solr参数,使用solr作为索引。但是按照安装的一些方法搭建好环境以后,nutch可以单独运行,solr也可以单独正常运行。但是nutch向solr发送的时候出现空指针异常。查看错误提示发现时batchId是空值导致的。最后在crawler.java中添加了Nutch.AGR_BATCH的值,这个值是-all。根据solr运行的提示:Usage: SolrIndexerJob <solr url> (<batchId> | -all | -reindex) [-crawlId <id>],可见可以用-all替换batchId。修改后,可以正常用solr索引了。

       if (solrUrl != null) {
            status.put(Nutch.STAT_PHASE, "index");
            args.put(Nutch.ARG_BATCH, "-all");
            jobRes = runTool(SolrIndexerJob.class, args);
            if (jobRes != null) {
                subTools.put("index", jobRes);
            }
        }

显示如下:

原文地址:https://www.cnblogs.com/fengjiaoan/p/3438169.html