Expected mime type application/octet-stream but got text/html.
在运行solr技术的工程的时候出现Expected mime type application/octet-stream but got text/html.错误
网上找的原因有:
在使用Tomcat部署Solr后,Collection1的地址为:http://ip:8080/solr/#/collection1,但使用SolrJ进行索引的时候,应该使用http://ip:8080/solr/collection1,即无中间的#号。
即正确代码为:
- String serverUrl = (args != null && args.length > 0) ? args[0]
- : "http://ip:8080/solr/collection1";
- String serverUrl = (args != null && args.length > 0) ? args[0]
- : "http://ip:8080/solr/#/collection1";
但是我的是因为solrServer配置出错,正确的应该是:
<bean id="httpSolrServer" class="org.apache.solr.client.solrj.impl.HttpSolrServer">
<constructor-arg index="0" value="http://localhost:8081/solr"/>
</bean>
同时应该开启tomcat服务器中的startup.bat。这样子solr才能访问成功