Any clue to why this is happening will be greatly appreciated. This has become 
a blocker for me.
I can use the HTTPSolrServer to create a core/make requests etc, but then it 
behaves like Solr 3.6
http://host:port/solr/admin/cores and not 
http://host:port/solr/admin/collections

With my setup (4 servers running at localhost 8983, 8900, 7574 and 7500) when I 
manually do a 
http://127.0.0.1:7500/solr/admin/cores?action=CREATE&name=myColl1&instanceDir=default&dataDir=myColl1Data&collection=myColl1&numShards=2
it creates the collection only at the 7500 server. This is similar to when I 
use HttpSolrServer (Solr 3.6 behavior).

And of course when I initiate a 
http://127.0.0.1:7500/solr/admin/collections?action=CREATE&name=myColl2&instanceDir=default&dataDir=myColl2Data&collection=myColl2&numShards=2
as expected it creates the collection spread on 2 servers. I am failing to 
achieve the same with SolrJ. As in the code at the bottom of the mail, I use 
CloudSolrServer and get the No live SolrServers exception.

Any help or direction will of how to create collections (using the collections 
API) using SolrJ will be highly appreciated.

Regards
Jay


-----Original Message-----
From: Jay Parashar [mailto:jparas...@itscape.com] 
Sent: Sunday, January 06, 2013 7:42 PM
To: solr-user@lucene.apache.org
Subject: RE: Solr 4 exceptions on trying to create a collection

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