[
https://issues.apache.org/jira/browse/SOLR-4502?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14262246#comment-14262246
]
Alan Woodward commented on SOLR-4502:
-------------------------------------
The bug description actually describes the solution for this, you need to call
CoreContainer.load() (or create with CoreContainer.createAndLoad()). But this
is trappy. You *always* have to call load(), or you'll start to get weird
issues like this one if you try to use any SolrCores created by the container.
I think the best solution is to call load() from the constructor. Rename
load() to init(), make it a private method, and add a no-op deprecated load()
method so that compilation still works. We can deprecate createAndLoad() as
well.
> ShardHandlerFactory not initialized in CoreContainer when creating a Core
> manually.
> -----------------------------------------------------------------------------------
>
> Key: SOLR-4502
> URL: https://issues.apache.org/jira/browse/SOLR-4502
> Project: Solr
> Issue Type: Bug
> Affects Versions: 4.1
> Reporter: Michael Aspetsberger
> Assignee: Mark Miller
> Labels: NPE
> Fix For: 4.9, Trunk
>
>
> We are using an embedded solr server for our unit testing purposes. In our
> scenario, we create a {{CoreContainer}} using only the solr-home path, and
> then create the cores manually using a {{CoreDescriptor}}.
> While the creation appears to work fine, it hits an NPE when it handles the
> search:
> {quote}
> Caused by: java.lang.NullPointerException
> at
> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:181)
> at
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
> at org.apache.solr.core.SolrCore.execute(SolrCore.java:1816)
> at
> org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:150)
> {quote}
> According to
> http://mail-archives.apache.org/mod_mbox/lucene-solr-user/201301.mbox/%3CE8A9BF60-5577-45F9-8BEA-B85616C6539D%40gmail.com%3E
> , this is due to a missing {{CoreContainer#load}}.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]