Thanks for your reply.

The problem was server instance. I configured different version of tomcat which 
does not have the solr server in my net beans. I changed the tomcat in which 
solr server runs. Now it works.   

-----Original Message-----
From: Noble Paul നോബിള്‍ नोब्ळ् [mailto:noble.p...@gmail.com] 
Sent: Monday, March 23, 2009 5:01 PM
To: solr-user@lucene.apache.org; cra...@ceiindia.com
Subject: Re: Error when execute the solrj client

just hit solr with a browser with the url 
http://localhost:8080/solr/select?q=Glenn
and see if it works.
--Noble

On Mon, Mar 23, 2009 at 4:36 PM, Radha C. <cra...@ceiindia.com> wrote:
> I am getting the following error when executing solrj client.
>
> Can anyone aware of this error, any help will be great. Thanks in advance.
>
> org.apache.solr.client.solrj.SolrServerException: Error executing 
> query
>        at
> org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:
> 96)
>        at
> org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:113)
>        at SolrjTest.query(SolrjTest.java:36)
>        at SolrjTest.main(SolrjTest.java:72) Caused by: 
> org.apache.solr.common.SolrException: /solr/select
>
> /solr/select
> request: http://localhost:8080/solr/select?q=Glenn
> <http://localhost:8080/solr/select?q=Glenn&wt=javabin> &wt=javabin
>        at
> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(Common
> sHttpS
> olrServer.java:428)
>        at
> org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(Common
> sHttpS
> olrServer.java:245)
>        at
> org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:
> 90)
>        ... 3 more
>
> Here is my java client
>
> import org.apache.solr.common.SolrDocumentList;
> import org.apache.solr.common.SolrDocument;
> import java.util.Map;
> import java.util.Iterator;
> import java.util.List;
> import java.util.ArrayList;
> import java.util.HashMap;
>
> import org.apache.solr.client.solrj.SolrServerException;
> import org.apache.solr.client.solrj.SolrQuery;
> import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
> import org.apache.solr.client.solrj.response.QueryResponse;
> import org.apache.solr.client.solrj.response.FacetField;
>
>
> class SolrjTest
> {
>    public void query(String q)
>    {
>        CommonsHttpSolrServer server = null;
>
>        try
>        {
>            server = new
> CommonsHttpSolrServer("http://localhost:8080/solr/";);
>        }
>        catch(Exception e)
>        {
>            e.printStackTrace();
>        }
>
>        SolrQuery query = new SolrQuery();
>        query.setQuery(q);
>
>        try
>        {
>            QueryResponse qr = server.query(query);
>
>            SolrDocumentList sdl = qr.getResults();
>
>            System.out.println("Found: " + sdl.getNumFound());
>            System.out.println("Start: " + sdl.getStart());
>            System.out.println("Max Score: " + sdl.getMaxScore());
>            System.out.println("--------------------------------");
>
>            ArrayList<HashMap<String, Object>> hitsOnPage = new 
> ArrayList<HashMap<String, Object>>();
>
>            for(SolrDocument d : sdl)
>            {
>                HashMap<String, Object> values = new HashMap<String,
> Object>();
>
>                for(Iterator<Map.Entry<String, Object>> i = 
> d.iterator(); i.hasNext(); )
>                {
>                    Map.Entry<String, Object> e2 = i.next();
>
>                    values.put(e2.getKey(), e2.getValue());
>                }
>
>                hitsOnPage.add(values);
>                System.out.println(values.get("displayname") + " (" +
> values.get("displayphone") + ")");
>            }
>        }
>        catch (SolrServerException e)
>        {
>            e.printStackTrace();
>        }
>
>    }
>
>    public static void main(String[] args)
>    {
>        SolrjTest solrj = new SolrjTest();
>        solrj.query("Glenn");
>    }
> }
>
>
>



--
--Noble Paul

Reply via email to