In my spring-data-solr project, Im getting
org.springframework.data.solr.UncategorizedSolrException: Error from server at http://localhost:8983/solr/preauth: Expected mime type application/octet-stream but got text/html.
The URL that gets generated while any operation is wrong. It contains the core name twice.
The Stack Trace:
<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/preauth/preauth/select. Reason:
<pre> Not Found</pre></p>
</body>
</html>
The solr url contains the core name "preauth" twice.
My dependency:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-solr</artifactId>
<version>2.1.0.RELEASE</version>
</dependency>
My Configuration:
@Configuration
@EnableSolrRepositories(basePackages = { "com.abi.claimbook" }, multicoreSupport = true)
public class SolrConfig {
@Value("${solr.claimbook.url}")
private String host;
@Bean
public SolrClient solrClient() throws Exception {
HttpSolrClientFactoryBean factory = new HttpSolrClientFactoryBean();
factory.setUrl(host);
factory.afterPropertiesSet();
SolrClient client = factory.getSolrClient();
return client;
}
@Bean
public SolrTemplate solrTemplate(SolrClient solrClient) throws Exception {
SolrTemplate solrTemplate = new SolrTemplate(solrClient);
return solrTemplate;
}
}
My Document bean:
@SolrDocument(solrCoreName = "preauth")
public class Preauth {
@Id
@Indexed
@Field
private Integer preauthId;
@Indexed
@Field
private String patientName;
@Indexed
@Field
private String alNumber;
.....
Getters and setters...
.....
My Repository:
public interface SolrPreauthRepository extends SolrCrudRepository<Preauth, Integer> {
}