【问题标题】:org.apache.solr.common.SolrException: missing content streamorg.apache.solr.common.SolrException:缺少内容流
【发布时间】:2019-07-19 13:44:15
【问题描述】:

我已经用 Tomcat 安装了 Apache Solr,我的 /solr/admin 工作正常。但是当我尝试发出/solr/update 时,我收到以下错误。可能是什么原因?

org.apache.solr.common.SolrException:缺少内容流

【问题讨论】:

  • 您可以发布您要发送到服务器的更新 XML 吗?你怎么发帖?使用 curl、使用应用程序、使用浏览器?
  • 我尝试运行 ./post.sh 带有 exampledoc。但它说找不到卷曲。当我尝试像localhost:8080/apache-solr-1.4.1/update 一样点击时,我得到了内容流丢失的 400 错误。这是我的 post.sh FILES=$* URL=localhost:8080/apache-solr-1.4.1/update for f in $FILES;做 echo Posting file $f to $URL curl $URL --data-binary @$f -H 'Content-type:text/xml; charset=utf-8' echo done #发送提交命令以确保所有更改都已刷新并可见 curl $URL --data-binary '' -H 'Content-type:text/xml; charset=utf-8' 回声
  • 我已经用 java -Durl=localhost:8080/apache-solr-1.4.1/update -jar post.jar *.xml 修复了它
  • 您能以对他人有所帮助的方式回答您自己的问题吗?如果你这样做,你可以选择你的作为正确答案。这可能看起来很奇怪,但它是处理此类情况的首选方式。

标签: solr


【解决方案1】:

如果您添加提交参数,即?commit=true,它将起作用

【讨论】:

    【解决方案2】:

    /solr/update 将查找要索引的任何输入文档。运行普通的/solr/update 将导致此异常,因为它没有输入。运行它的最简单方法是,

    java -Durl=localhost:8080/<your apache solr context path, mostly solr>/update -jar post.jar *.xml
    

    如果您尝试持久化一个空的文档集合,这也可能通过 SolrJ/spring-data-solr 发生。

    所以solrClient.add(new ArrayList&lt;SolrInputDocument&gt;(), 10000);

    也会导致错误。

    【讨论】:

    • 其他人注意:如果您尝试持久化一个空的文档集合,这也可能通过 SolrJ/spring-data-solr 发生。
    • 使用 SOLRJ 发布空列表对象时也可能出现“缺少内容流”
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-24
    • 1970-01-01
    相关资源
    最近更新 更多