solr exception预期的mime类型application / octet-stream但是得到了text / html

问题描述 投票:3回答:2

嗨,我试图使用spring boot data 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);
}

我的基本网址是"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中附加名称。谁能帮我。提前致谢

java spring-boot solr
2个回答
0
投票

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


-3
投票

检查您的网址是否正确。

© www.soinside.com 2019 - 2024. All rights reserved.