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>
@SolrDocument(solrCoreName="workspaces")
public class Workspace
{
}
@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());
}
public interface WorkspaceRepository extends SolrCrudRepository<Workspace, String>
{
List<Workspace> findByUserId(String userId);
}
I had the exact same problem and solved it by using Spring Boot version 1.4.3.RELEASE, instead of 1.5.1.RELEASE...