java 使用 Solr 索引文档导致预期的 MIME 类型应用程序/八位字节流但得到 text/html

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29277972/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 14:59:11  来源:igfitidea点击:

Indexing documents using Solr results in Expected mime type application/octet-stream but got text/html

javaindexingsolrsolrj

提问by Abdelrahman Shoman

What I am trying to do is to index document using Solr.

我想要做的是使用 Solr 索引文档。

I have installed and started Solr server on a Windows environment and I am trying to index using SolrJ.

我已经在 Windows 环境中安装并启动了 Solr 服务器,我正在尝试使用 SolrJ 进行索引。

However when I try to add the solr document to the server as shown below it results in the an error

但是,当我尝试将 solr 文档添加到服务器时,如下所示,它会导致错误

server.add(indexDoc);

Error

错误

Error from server at http://localhost:8983/solr: Expected mime type application/octet-stream but got text/html

<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /solr/update. Reason:
<pre>    Not Found</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>

What would be the possible reason for this issue.

这个问题的可能原因是什么。

回答by wholevinski

I think the 404 error is more relevant to your problem... See this: Error 404: Prob accessing /solr/update. Reason: Not Found

我认为 404 错误与您的问题更相关...请参阅:错误 404:Prob accessing /solr/update。原因:未找到

You're missing your collection name in the URL.

您在 URL 中缺少您的集合名称。

回答by Root

In my case it was because the Corewas not there which I have specified here @SolrDocument(solrCoreName = "documents")There should be a corewith the name documentspresent on the server.

就我而言,这是因为我在此处指定的Core不在那里服务器上@SolrDocument(solrCoreName = "documents")应该有一个core带有名称的文档

So I created the core from the command line on windows using the following command bin/solr.cmd create -c documents -p 8983.

因此,我使用以下命令从 Windows 上的命令行创建了核心bin/solr.cmd create -c documents -p 8983

Then it worked in my case.

然后它在我的情况下起作用。

回答by Vedanshu

In my case core was missing. Create the nutchcore using following command:

在我的情况下,核心丢失了。nutch使用以下命令创建核心:

${APACHE_SOLR_HOME}/bin/solr create -c nutch -d ${APACHE_SOLR_HOME}/server/solr/configsets/nutch/conf/

Also, check the status of core by:

另外,通过以下方式检查核心的状态:

localhost:8983/solr/admin/cores?action=STATUS 

回答by rajsfk

Check your field names in Collection and Application they are mismatched.

检查 Collection 和 Application 中的字段名称,它们不匹配。