I figured it out. Since this Solr server does not has an SSL interface, I had to change the following line from 443 to 80:
AuthScope scope = new AuthScope(host, 80, "resin");

Erlend

On 09.03.11 17.09, Erlend Garåsen wrote:

I'm trying to do a search with SolrJ using digest authentication, but
I'm getting the following error:
org.apache.solr.common.SolrException: Unauthorized

I'm setting up SolrJ this way:

HttpClient client = new HttpClient();
List<String> authPrefs = new ArrayList<String>();
authPrefs.add(AuthPolicy.DIGEST);
client.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY,
authPrefs);
AuthScope scope = new AuthScope(host, 443, "resin");
client.getState().setCredentials(scope, new
UsernamePasswordCredentials(username, password));
client.getParams().setAuthenticationPreemptive(true);
SolrServer server = new CommonsHttpSolrServer(server, client);

Is this something which is not supported by SolrJ or have I written
something wrong in the code above?

Erlend



--
Erlend Garåsen
Center for Information Technology Services
University of Oslo
P.O. Box 1086 Blindern, N-0317 OSLO, Norway
Ph: (+47) 22840193, Fax: (+47) 22852970, Mobile: (+47) 91380968, VIP: 31050

Reply via email to