OldManCoder OldManCoder - 4 years ago 211
Java Question

duplicate cores in url sent to solr from spring boot solr data

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).


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.
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 404 Not Found</title>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /solr/workspaces/workspaces/select. Reason:
<pre> Not Found</pre></p>


public class Workspace

Defined in SolrContext.java Also, "multicoreSupport = true" at top

public SolrClient solrClient()
SolrClient retval = new HttpSolrClient.Builder(environment.getRequiredProperty(PROPERTY_NAME_SOLR_SERVER_URL)).build();

return retval;

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:

  • spring-boot-starter-data-solr-1.5.1.RELEASE

  • solr-solrj-6.3.0

  • spring-data-solr-2.1.0.RELEASE

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.


Answer Source

I had the exact same problem and solved it by using Spring Boot version 1.4.3.RELEASE, instead of 1.5.1.RELEASE...

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download