Reputation: 33
Solr Spring boot is inserting an additional core name in the url when accessing the Solr server. This can be seen from the following error. The initial error correctly states the URL, but the http error returned from Solr states that the URL accessed duplicated the core (workspaces).
Error
Caused by: org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://x.x.x.x:8983/solr/workspaces: 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/workspaces/workspaces/select. Reason:
<pre> Not Found</pre></p>
</body>
</html>
Document.java
@SolrDocument(solrCoreName="workspaces")
public class Workspace
{
}
Defined in SolrContext.java Also, "multicoreSupport = true" at top
@Bean
public SolrClient solrClient()
{
SolrClient retval = new HttpSolrClient.Builder(environment.getRequiredProperty(PROPERTY_NAME_SOLR_SERVER_URL)).build();
return retval;
}
@Bean
public SolrTemplate solrTemplate()
{
return new SolrTemplate(solrClient());
}
I attempted at one point adding additional @Beans with SolrTemplate, one for each core. The url then ended up appending each of the cores to the url. Very odd. The repository I am accessing is pretty standard.
public interface WorkspaceRepository extends SolrCrudRepository<Workspace, String>
{
List<Workspace> findByUserId(String userId);
}
This is using:
Note, I started with the default solr-solrj that was defined with spring-data-solr-2.1.0, but got the same issue so I upped it to 6.3.0.
Anyway, I hope someone has seen this before and can add a little guidance as to what I am doing wrong.
Thanks
Upvotes: 3
Views: 1086
Reputation: 2124
It is a Spring Data Solr Bug, will be fixed in 2.1.2 (Ingalls SR2) and 3.0 M2 (Kay) see https://jira.spring.io/browse/DATASOLR-364 to get more info.
Upvotes: 0
Reputation: 84
I had the exact same problem and solved it by using Spring Boot version 1.4.3.RELEASE, instead of 1.5.1.RELEASE...
Upvotes: 2