I have configure Solr 6.2.1 as SolrCloud and i have Configured Basic Authentication so i am going to configure Spring data solr 2.0.4.RELEASE with Solrj 6.2 and this is my
code: @Configuration @EnableSolrRepositories(basePackages = { "ir.saeed.server.solr" }, multicoreSupport = true) public class SearchContext { @Value("${solr.host}") private String host; @Value("${solr.port}") private Integer port; @Value("${solr.username}") private String username; @Value("${solr.password}") private String password; @Value("${zkHost}") private String zkHost; @Value("${solr.coreName}") private String collectionName; @Bean public SolrTemplate solrTemplate() { return new SolrTemplate(solrClientFactory()); } @Bean public BasicCredentialsProvider credentialsProvider() { BasicCredentialsProvider provider = new BasicCredentialsProvider(); provider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(username, password)); return provider; } @Bean public SolrClientFactory solrClientFactory() { return new HttpSolrClientFactory(solrClient(), "", credentialsProvider().getCredentials(AuthScope.ANY), "BASIC"); } @Bean public SolrClient solrClient() { return new CloudSolrClient.Builder().withZkHost(zkHost).build(); } } But when i run my web application this Exception occures: 10:51:48,110 org.springframework.data.solr.UncategorizedSolrException: nested exception is java.lang.NullPointerException 10:51:48,111 at org.springframework.data.solr.core.SolrTemplate.execute(SolrTemplate.java:172) 10:51:48,111 at org.springframework.data.solr.core.SolrTemplate.executeSolrQuery(SolrTemplate.java:509) 10:51:48,111 at org.springframework.data.solr.core.SolrTemplate.query(SolrTemplate.java:504) 10:51:48,111 at org.springframework.data.solr.core.SolrTemplate.doQueryForPage(SolrTemplate.java:338) 10:51:48,111 at org.springframework.data.solr.core.SolrTemplate.queryForPage(SolrTemplate.java:350) How can i solve my problem? I think my Configuration is incorrect