You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Ranjeet <ra...@ebusinessware.com> on 2008/07/14 09:30:15 UTC

Using SolrJ for response

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 

Re: Using SolrJ for response

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com>.
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 <ra...@ebusinessware.com> 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