On 10/18/2016 2:39 PM, wmcgin...@cox.net wrote:
> What causes this?
> Exception in thread "main" java.lang.NoClassDefFoundError: 
> org/apache/http/impl/client/CloseableHttpClient
>       at 
> org.apache.solr.client.solrj.impl.HttpSolrClient.<init>(HttpSolrClient.java:209)
>       at 
> org.apache.solr.client.solrj.impl.HttpSolrClient$Builder.build(HttpSolrClient.java:874)

This is most likely caused by having multiple versions of jars on your
classpath.  You've probably got an older version of the HttpComponents
jars (httpclient, httpmime, httpcore) somewhere that's missing a class
that SolrJ needs from the newer version.  The correct jar versions can
be found included with Solr.

> The code is:
> return new HttpSolrClient.Builder(urlString).build();
> After connecting to a Solr server, should I call solrServer.close();
> or
> should I leave the connection open until the entire index is built?

The intent is that the client object will be created once and used in
the program until it stops running.  Many users *never* close the
client.  It can also be shared by multiple threads with no problems.


Reply via email to