【问题标题】:solr exception Expected mime type application/octet-stream but got text/htmlsolr 异常预期 mime 类型 application/octet-stream 但得到 text/html
【发布时间】:2017-03-03 10:18:14
【问题描述】:

您好,我正在尝试使用 Spring Boot 数据 solr 为 solr 中的实体建立索引。但我得到了例外

    Caused by: org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://localhost:8983/solr/portal: Expected mime type application/octet-stream but got text/html. <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /solr/portal/publishers/update. Reason:
<pre>    Not Found</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>

</body>
</html>

这是我的发布者类

    @SolrDocument
public class Publishers {

    @Id
    @Field
    private String advID;
    @Field
    private String name;
    @Field
    private String domain;
    @Field("cat")
    private String categories;

     //getters and setters
}

我的仓库界面

    public interface BookRepository extends SolrCrudRepository<Publishers, String> {

    List<Publishers> findByName(String name);
}

我的基本 URL 是 "http://localhost:8983/solr/portal"。在我的主类代码如下

    @Resource
    BookRepository repository;
 @Override
    public void run(String... strings) throws Exception {
this.repository.save(new Publishers("4", "Sony Playstation","none", null));
}

更新 我观察到实体类,即Publishers 名称会自动附加到 URL。我不知道如何告诉应用程序在向 solr 发送调用时不要在 solr URL 中附加名称。 谁能帮我。提前致谢

【问题讨论】:

  • 您在何时何地遇到该异常?
  • 当我保存我的发布者时,请查看我的 run()

标签: java spring-boot solr


【解决方案1】:

您应该将您的 solr 文档注释为 @SolrDocument(solrCoreName="YOU_CORE_NAME")

【讨论】:

    【解决方案2】:

    检查您的网址是否正确。

    【讨论】:

      猜你喜欢
      • 2015-05-30
      • 2015-03-03
      • 1970-01-01
      • 1970-01-01
      • 2015-08-29
      • 2011-09-19
      • 2015-02-17
      • 2012-03-31
      • 2012-04-16
      相关资源
      最近更新 更多