Search code examples
javaapachesolrsolrj

Can’t import org.apache.solr.client.solrj.impl.HttpSolrServer


I am going to use a Solr server which will receive some data from a server by the Solrj framework (I heard that it is a framework, but I am not sure). I did not find many documentation for Solrj, so I used its wiki.

When I follow the explanations, I find that all the jars were not in my jar list when I copied the dependency, so I had to download the apache-solr-solrj-*.jar and made other dependencies.

But a bigger problem is, I cannot import org.apache.solr.client.solrj.impl.HttpSolrServer consequently, I cannot call HttpSolrServer. My IDE recognise CommonsHttpSolrServer, although it does not want to use it (maybe because it does not exist).


Solution

  • Well solrj is the java client api to interact with solr. Also, solrj has changed the way you interact with solr based on solrj version. So please verify the documenttation for the version of solr which you are using. generally the below snippet should take care of fetching all the dependencies for solrj.

            <dependency>
              <artifactId>solr-solrj</artifactId>
              <groupId>org.apache.solr</groupId>
              <version>4.10.3</version>
            </dependency>