Using SolrJ for response

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using SolrJ for response

ranjeetkr
Hi,

I am new to solrJ, in following code I got exception. Plese help, we did not get getParams() method in HttpConnectionManager. In which jar we get with this method.

public static void main (String [] args) {


/*String url = "http://localhost:8983/solr";

SolrServer server = new CommonsHttpSolrServer( url );


server.setParser(new XMLResponseParser());*/

try {

SolrServer server = getSolrServer();

SolrQuery solrQuery = new SolrQuery().

setQuery("computer").

setFacet(true).

setFacetMinCount(1).

setFacetLimit(8).

addFacetField("category").

addFacetField("inStock");

QueryResponse rsp = server.query(solrQuery);

SolrDocumentList docs = rsp.getResults();


//List<Item> beans = rsp.getBeans(Item.class);


} catch(Exception ex) {

System.out.println(ex.getMessage());

ex.printStackTrace();

}

}

Exception got:

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.commons.httpclient.HttpConnectionManager.getParams()Lorg/apache/commons/httpclient/params/HttpConnectionManagerParams;

at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.setDefaultMaxConnectionsPerHost(CommonsHttpSolrServer.java:455)

at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.<init>(CommonsHttpSolrServer.java:152)

at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.<init>(CommonsHttpSolrServer.java:125)

at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.<init>(CommonsHttpSolrServer.java:97)

at com.xonos.ecommerce.search.solr.SolrClient.getSolrServer(SolrClient.java:50)

at com.xonos.ecommerce.search.solr.SolrClient.main(SolrClient.java:26)




Thanks & Regards,
Ranjeet
Reply | Threaded
Open this post in threaded view
|

Re: Using SolrJ for response

Noble Paul നോബിള്‍  नोब्ळ्
You may need to check your classpath and ensure that you are using the
correct versions of httpclient (the ones shipped with solr)


On Mon, Jul 14, 2008 at 1:00 PM, Ranjeet <[hidden email]> wrote:

> Hi,
>
> I am new to solrJ, in following code I got exception. Plese help, we did not get getParams() method in HttpConnectionManager. In which jar we get with this method.
>
> public static void main (String [] args) {
>
>
> /*String url = "http://localhost:8983/solr";
>
> SolrServer server = new CommonsHttpSolrServer( url );
>
>
> server.setParser(new XMLResponseParser());*/
>
> try {
>
> SolrServer server = getSolrServer();
>
> SolrQuery solrQuery = new SolrQuery().
>
> setQuery("computer").
>
> setFacet(true).
>
> setFacetMinCount(1).
>
> setFacetLimit(8).
>
> addFacetField("category").
>
> addFacetField("inStock");
>
> QueryResponse rsp = server.query(solrQuery);
>
> SolrDocumentList docs = rsp.getResults();
>
>
> //List<Item> beans = rsp.getBeans(Item.class);
>
>
> } catch(Exception ex) {
>
> System.out.println(ex.getMessage());
>
> ex.printStackTrace();
>
> }
>
> }
>
> Exception got:
>
> Exception in thread "main" java.lang.NoSuchMethodError: org.apache.commons.httpclient.HttpConnectionManager.getParams()Lorg/apache/commons/httpclient/params/HttpConnectionManagerParams;
>
> at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.setDefaultMaxConnectionsPerHost(CommonsHttpSolrServer.java:455)
>
> at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.<init>(CommonsHttpSolrServer.java:152)
>
> at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.<init>(CommonsHttpSolrServer.java:125)
>
> at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.<init>(CommonsHttpSolrServer.java:97)
>
> at com.xonos.ecommerce.search.solr.SolrClient.getSolrServer(SolrClient.java:50)
>
> at com.xonos.ecommerce.search.solr.SolrClient.main(SolrClient.java:26)
>
>
>
>
> Thanks & Regards,
> Ranjeet



--
--Noble Paul