0

Trying to implement a custom solr repository and injected solrTemplate (using @Resource) to the custom*Impl.java but it is null and throwing below exception.

Tried all the options but in vain.

    SEVERE: Servlet.service() for servlet [collection-search] in context with path [/collection-search] threw exception [Request processing failed; nested exception is org.springframework.data.solr.UncategorizedSolrException: Expected mime type application/octet-stream but got text/html. <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /solr/select. Reason:
<pre>    Not Found</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                

</body>
</html>
Java Geek
  • 1
  • 1
  • Please show us your code where you try to inject the repository and not only the HTML-Output of the Error – bish Jun 30 '15 at 15:50
  • Hi @bish, please find below code: Configuration EnableSolrRepositories(basePackages = { "package_name" }, multicoreSupport = true) PropertySource("classpath:application.properties") public class SearchContext { Resource private Environment environment; private MulticoreSolrServerFactory factory; private SolrServer solrServer; private SolrTemplate solrTemplate; Bean public SolrServer solrServer() { solrServer = new HttpSolrServer(environment.getRequiredProperty(SOLR_HOST)); return solrServer; } – Java Geek Jun 30 '15 at 20:00
  • Bean public SolrTemplate solrTemplate() throws Exception { solrTemplate = new SolrTemplate(factory.getSolrServer()); return solrTemplate; } Bean public MulticoreSolrServerFactory solrServerFactoryBean() { factory = new MulticoreSolrServerFactory(solrServer, "collection-search"); return factory; } } – Java Geek Jun 30 '15 at 20:05
  • Also created CustomDocumentRepository.java (interface that extends SolrCRUDRepository) and CustomDocumentRepositoryImpl.java that implements CustomDocumentRepository – Java Geek Jun 30 '15 at 20:08
  • Followed same steps as in http://stackoverflow.com/questions/16859181/spring-data-solr-multiple-cores-and-repository/20857352 – Java Geek Jun 30 '15 at 22:04
  • Code base is similar to following git link, https://github.com/pkainulainen/spring-data-solr-examples – Java Geek Jun 30 '15 at 22:06
  • Similar issues is discussed in following link: http://stackoverflow.com/questions/28353201/indexing-document-to-a-specific-collection-using-spring-data-solr – Java Geek Jun 30 '15 at 22:08
  • Please do not post this all in the comments where it's unformated but in your question. You can edit it via the edit-button. – bish Jul 01 '15 at 04:56
  • @bish Appreciate your interest, able to solve the issue. For some reason solrTemplate is not recognizing solrCore, so I have manually invoked setSolrCore("collection-search") on solrTemplate after injection in my custom repository class. It's working now. – Java Geek Jul 02 '15 at 19:56
  • Did you creat that core? http://stackoverflow.com/questions/31791107/solr-throwing-rg-apache-solr-client-solrj-impl-httpsolrserverremotesolrexceptio – Cipous Sep 29 '15 at 15:45

0 Answers0