我搭建了一套 Solr5.5.5 的环境 spring-data-solr也是5.5.5版本 使用的是内置的服务器运行的,控制台操控solr正常但是,集成到Springboot后疯狂报错!
控制台截图如下:

springboot环境如下:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-solr</artifactId>
</dependency>

配置文件如下:
#application.properties 并不是yml格式,不知道有没有影响
spring.data.solr.host=http://127.0.0.1:8983/solr/new_core
代码如下
@Autowired
private SolrClient solrClient
public class ArticleViewServiceImplimplements ArticleViewService {
@Override
public List<Article> testSolr() throws IOException, SolrServerException {
SolrQuery solrQuery = new SolrQuery(); solrQuery.set("q","id:34306219391547cc8f817c08bae95177");
QueryResponse query = solrClient.query(solrQuery);
for (SolrDocument result : query.getResults()) {
System.out.println(result.get("new_title"));
}
return null;
}
}
启动报错信息如下(启动报错)
2019-07-24 10:48:26.038 [RMI TCP Connection(5)-10.0.101.76] WARN o.s.boot.actuate.health.SolrHealthIndicator - Health check failed org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://127.0.0.1:8983/solr/new_core: 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/new_core/admin/cores. Reason: <pre> Not Found</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>
</body> </html>
大佬们,谢谢大佬们