You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Vimlesh Kumar Mishra (JIRA)" <ji...@apache.org> on 2012/05/04 08:11:07 UTC
[jira] [Commented] (SOLR-2312) CloudSolrServer -- calling
add(Collection docs) throws NPE.
[ https://issues.apache.org/jira/browse/SOLR-2312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13268158#comment-13268158 ]
Vimlesh Kumar Mishra commented on SOLR-2312:
--------------------------------------------
I also can't reproduce this issue.Solr cloud idexing is working fine with below code.
SolrServer solr = new CloudSolrServer("your.zookeeper.localdomain:2181");
((CloudSolrServer)solr).setDefaultCollection("your-collection");
solr.add(<List of solr documents>);
solr.commit();
> CloudSolrServer -- calling add(Collection<SolrInputDocument> docs) throws NPE.
> ------------------------------------------------------------------------------
>
> Key: SOLR-2312
> URL: https://issues.apache.org/jira/browse/SOLR-2312
> Project: Solr
> Issue Type: Bug
> Components: SolrCloud
> Affects Versions: 4.0
> Environment: Mac OSX v10.5.8
> java version "1.6.0_22"
> Java(TM) SE Runtime Environment (build 1.6.0_22-b04-307-9M3263)
> Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03-307, mixed mode)
> Reporter: Stan Burnitt
> Assignee: Mark Miller
> Priority: Critical
> Fix For: 4.0
>
>
> Cannot index documents using the CloudSolrServer.
> Below is a code snippet that reproduces the error.
> {code:borderStyle=solid}
> @Test
> public void jiraTestCase() {
> CloudSolrServer solrj = null;
>
> try {
> solrj = new CloudSolrServer("your.zookeeper.localdomain:2181");
> // Also tried creating CloudSolrServer using alternative contstuctor below...
> // public CloudSolrServer(String zkHost, LBHttpSolrServer lbServer)
> //
> // LBHttpSolrServer lbHttpSolrServer = new LBHttpSolrServer("http://solr.localdomain:8983/solr");
> // solrj = new CloudSolrServer("your.zookeeper.localdomain:2181", lbHttpSolrServer);
> //
> // (Same result -- NPE @ line 105 in CloudSolrServer.java)
> solrj.setDefaultCollection("your-collection");
> solrj.setZkClientTimeout(5000);
> solrj.setZkConnectTimeout(5000);
> final Collection<SolrInputDocument> batch = new ArrayList<SolrInputDocument>();
> SolrInputDocument doc = new SolrInputDocument();
> doc.addField("id", 1L, 1.0f);
> doc.addField("title", "Document A");
> doc.addField("description", "Test document");
> batch.add(doc);
> doc = new SolrInputDocument();
> doc.addField("id", 2L, 1.0f);
> doc.addField("title", "Document B");
> doc.addField("description", "Another test document");
> batch.add(doc);
> solrj.add(batch);
> } catch (Exception e) {
> log.error(e.getMessage(), e);
> Assert.fail("java.lang.NullPointerException: null \n"
> + " at org.apache.solr.client.solrj.impl.CloudSolrServer.request(CloudSolrServer.java:105) \n"
> + " Line 105: NULL request object here --> String collection = request.getParams().get(\"collection\", defaultCollection);");
> } finally {
> solrj.close();
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org