post - 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/中的所有链接(指向文件和其他页面),所以我认为没有任何文件或链接带有特殊字符。谢谢大家,感谢您的帮助。
解决方案
删除 -Drecursive=2 ,它正在使用以下命令创建问题。
java -Dauto=yes -Dc=testcore -Ddata=web -Ddelay=10 -jar post.jar http://localhost/
推荐阅读
- tensorflow - 如何为 python 项目修复“没有名为“tensorflow.contrib”的模块?
- node.js - Nodejs mongoose子子文档搜索
- rest - 如何处理在 REST API 中引入新对象属性
- javascript - 如何将表列“转换为输入字段”并获取输入字段值和 ID?
- javascript - Collapse all Child Rows as default in DataTables
- python - 如何在 Python 中按字典的值正确排序?
- css - 如何为轮播设置 100% 宽度?
- c - 如何在 POSIX 正则表达式中写负前瞻
- mysql - 使用节点 js 连接到 My Sql 会引发错误“连接 ECONNREFUSED 127.0.0.1:3306”
- php - 在 php 中使用 str_shuffle 生成 4 位数的密码,但有时会得到 3 位数的数字