If you are using 4.0 you can't use the CloudSolrServer with the collections API 
- you have to pick a server and use the HttpSolrServer impl. In 4.1 you can use 
the CloudSolrServer with the collections API.

- Mark

On Jan 6, 2013, at 8:42 PM, Jay Parashar <jparas...@itscape.com> wrote:

> The exception "No live SolrServers" is being thrown when trying to create a 
> new Collection ( code at end of this mail). On the CloudSolrServer request 
> method, we have this line
> "ClientUtils.appendMap(coll, slices, clusterState.getSlices(coll));" where 
> "coll" is the new collection I am trying to create and hence 
> clusterState.getSlices(coll)); is returning null.
> And then the loop of the slices which adds to the urlList never happens and 
> hence the LBHttpSolrServer created in the CloudSolrServer has a null url list 
> in the constructor.
> This is giving the "No live SolrServers" exception.
> 
> What I am missing?
> 
> Instead of passing the CloudSolrServer to the create.process, if I pass the 
> LBHttpSolrServer  (server.getLbServer()), the collection gets created but 
> only on one server.
> 
> My code to create a new Cloud Server and new Collection:-
> 
> String[] urls = 
> {"http://127.0.0.1:8983/solr/","http://127.0.0.1:8900/solr/","http://127.0.0.1:7500/solr/","http://127.0.0.1:7574/solr/"};
> CloudSolrServer server = new CloudSolrServer("127.0.0.1:2181", new 
> LBHttpSolrServer(urls));
> server.getLbServer().getHttpClient().getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,
>  5000);
> server.getLbServer().getHttpClient().getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT,
>  20000);
> server.setDefaultCollection(collectionName);
> server.connect();
> CoreAdminRequest.Create create = new CoreAdminRequest.Create();
> create.setCoreName("myColl");
> create.setCollection("myColl");
> create.setInstanceDir("defaultDir");
> create.setDataDir("myCollData");
> create.setNumShards(2);
> create.process(server); //Exception No live SolrServers  is thrown here
> 
> 
> Thanks
> Jay
> 
> 
> -----Original Message-----
> From: Alexandre Rafalovitch [mailto:arafa...@gmail.com] 
> Sent: Friday, January 04, 2013 6:08 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Solr 4 exceptions on trying to create a collection
> 
> Tried Wireshark yet to see what host/port it is trying to connect and why it 
> fails? It is a complex tool, but well worth learning.
> 
> Regards,
>  Alex.
> 
> Personal blog: http://blog.outerthoughts.com/
> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
> - Time is the quality of nature that keeps events from happening all at once. 
> Lately, it doesn't seem to be working.  (Anonymous  - via GTD book)
> 
> 
> On Fri, Jan 4, 2013 at 6:58 PM, Jay Parashar <jparas...@itscape.com> wrote:
> 
>> Thanks! I had a different version of httpclient in the classpath. So 
>> the 2nd exception is gone but now I am  back to the first one " 
>> org.apache.solr.client.solrj.SolrServerException: No live SolrServers  
>> available to handle this request"
>> 
>> -----Original Message-----
>> From: Alexandre Rafalovitch [mailto:arafa...@gmail.com]
>> Sent: Friday, January 04, 2013 4:21 PM
>> To: solr-user@lucene.apache.org
>> Subject: Re: Solr 4 exceptions on trying to create a collection
>> 
>> For the second one:
>> 
>> Wrong version of library on a classpath or multiple versions of 
>> library on the classpath which causes wrong classes with missing 
>> fields/variables? Or library interface baked in and the implementation 
>> is newer. Some sort of mismatch basically. Most probably in Apache http 
>> library.
>> 
>> Regards,
>>   Alex.
>> 
>> Personal blog: http://blog.outerthoughts.com/
>> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
>> - Time is the quality of nature that keeps events from happening all 
>> at once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD 
>> book)
>> 
>> 
>> On Fri, Jan 4, 2013 at 4:34 PM, Jay Parashar <jparas...@itscape.com>
>> wrote:
>> 
>>> 
>>> Hi All,
>>> 
>>> I am getting exceptions on trying to create a collection. Any help 
>>> is appreciated.
>>> 
>>> While trying to create a collection, I got this error Caused by:
>>> org.apache.solr.client.solrj.SolrServerException: No live 
>>> SolrServers available to handle this request
>>>        at
>>> 
>>> 
>> org.apache.solr.client.solrj.impl.LBHttpSolrServer.request(LBHttpSolrServer.
>>> java:322)
>>>        at
>>> 
>>> org.apache.solr.client.solrj.impl.CloudSolrServer.request(CloudSolrS
>>> er
>>> ver.ja
>>> va:257)
>>>        at
>>> 
>>> org.apache.solr.client.solrj.request.CoreAdminRequest.process(CoreAd
>>> mi
>>> nReque
>>> st.java:423)
>>> 
>>> 
>>> On trying to increase the server timeout by
>>> 
>>> server.getLbServer().getHttpClient().getParams().setParameter(CoreCo
>>> nn
>>> ection
>>> PNames.CONNECTION_TIMEOUT, 5000);
>>> 
>>> server.getLbServer().getHttpClient().getParams().setParameter(CoreCo
>>> nn
>>> ection
>>> PNames.SO_TIMEOUT, 20000);
>>> 
>>> I get this...
>>> 
>>> SEVERE: The exception contained within MappableContainerException 
>>> could not be mapped to a response, re-throwing to the HTTP container
>>> java.lang.NoSuchFieldError: DEF_CONTENT_CHARSET
>>>        at
>>> 
>>> org.apache.http.impl.client.DefaultHttpClient.setDefaultHttpParams(D
>>> ef
>>> aultHt
>>> tpClient.java:175)
>>>        at
>>> 
>>> org.apache.http.impl.client.DefaultHttpClient.createHttpParams(Defau
>>> lt
>>> HttpCl
>>> ient.java:158)
>>>        at
>>> 
>>> 
>> org.apache.http.impl.client.AbstractHttpClient.getParams(AbstractHttpClient.
>>> java:448)
>>> 
>>> Thanks
>>> Jay
>>> 
>>> 
>> 
>> 
> 

Reply via email to