首页 > 解决方案 > Solr post.jar 因“prolog 中不允许内容”而崩溃

问题描述

我正在尝试评估 Solr,但无法使用递归选项开始抓取网站。到处寻找答案,但没有运气。环境:Windows Server 2012 r2,java版本“1.8.0_171”,solr-7.3.0。

运行 post.jar 工具时,出现以下错误:

java -Dauto=yes -Dc=testcore -Ddata=web -Drecursive=2 -Ddelay=10 -jar post.jar http://localhost/

SimplePostTool version 5.0.0
Posting web pages to Solr url http://localhost:8983/solr/testcore/update/extract
Entering auto mode. Indexing pages with content-types corresponding to file endings xml,json,jsonl,csv,pdf,doc,docx,ppt,pptx,xls,xlsx,odt,odp,ods,ott,otp,ots,rtf,htm,html,txt,log
Entering recursive mode, depth=2, delay=10s
Entering crawl at level 0 (1 links total, 1 new)
POSTed web resource http://localhost/ (depth: 0)
[Fatal Error] :1:1: Content is not allowed in prolog.
Exception in thread "main" java.lang.RuntimeException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
        at org.apache.solr.util.SimplePostTool$PageFetcher.getLinksFromWebPage(SimplePostTool.java:1252)
        at org.apache.solr.util.SimplePostTool.webCrawl(SimplePostTool.java:616)
        at org.apache.solr.util.SimplePostTool.postWebPages(SimplePostTool.java:563)
        at org.apache.solr.util.SimplePostTool.doWebMode(SimplePostTool.java:365)
        at org.apache.solr.util.SimplePostTool.execute(SimplePostTool.java:187)
        at org.apache.solr.util.SimplePostTool.main(SimplePostTool.java:172)
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
        at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
        at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
        at org.apache.solr.util.SimplePostTool.makeDom(SimplePostTool.java:1061)
        at org.apache.solr.util.SimplePostTool$PageFetcher.getLinksFromWebPage(SimplePostTool.java:1232)
        ... 5 more

如果我在关闭递归选项的情况下一一进行,我可以手动索引http://localhost/中的所有链接(指向文件和其他页面),所以我认为没有任何文件或链接带有特殊字符。谢谢大家,感谢您的帮助。

标签: postsolrxml-parsingweb-crawlersax

解决方案


删除 -Drecursive=2 ,它正在使用以下命令创建问题。

java -Dauto=yes -Dc=testcore -Ddata=web -Ddelay=10 -jar post.jar http://localhost/


推荐阅读