您的位置:首页 > 移动开发

Expected mime type application/octet-stream but got text/html.

2017-11-10 16:28 716 查看
在运行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才能访问成功
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  solr tomcat 服务器
相关文章推荐