solr - Solrj IOException occured when talking to server -
i using basic authentication. solr version 4.1. can query results when try index documents getting following error message:
org.apache.solr.client.solrj.solrserverexception: ioexception occured when talking server at: http://192.168.0.1:8983/solr/my_core @ org.apache.solr.client.solrj.impl.httpsolrserver.request(httpsolrserver.java:416) @ org.apache.solr.client.solrj.impl.httpsolrserver.request(httpsolrserver.java:181) @ org.apache.solr.client.solrj.request.abstractupdaterequest.process(abstractupdaterequest.java:117) @ org.apache.solr.client.solrj.solrserver.add(solrserver.java:116) @ org.apache.solr.client.solrj.solrserver.add(solrserver.java:102) @ warningletter.process.run(process.java:128) @ warningletter.warningletter.parselistpage(warningletter.java:81) @ warningletter.warningletter.init(warningletter.java:47) @ warningletter.warningletter.main(warningletter.java:21) caused by: org.apache.http.client.clientprotocolexception @ org.apache.http.impl.client.abstracthttpclient.execute(abstracthttpclient.java:822) @ org.apache.http.impl.client.abstracthttpclient.execute(abstracthttpclient.java:754) @ org.apache.http.impl.client.abstracthttpclient.execute(abstracthttpclient.java:732) @ org.apache.solr.client.solrj.impl.httpsolrserver.request(httpsolrserver.java:353) ... 8 more caused by: org.apache.http.client.nonrepeatablerequestexception: cannot retry request non-repeatable request entity. @ org.apache.http.impl.client.defaultrequestdirector.tryexecute(defaultrequestdirector.java:625) @ org.apache.http.impl.client.defaultrequestdirector.execute(defaultrequestdirector.java:464) @ org.apache.http.impl.client.abstracthttpclient.execute(abstracthttpclient.java:820) ... 11 more
this code piece:
defaulthttpclient httpclient = new defaulthttpclient(); httpclient.getcredentialsprovider().setcredentials(authscope.any, new usernamepasswordcredentials("user", "password")); httpsolrserver server = new httpsolrserver("http://192.168.0.1:8983/solr/warning_letter/", httpclient); solrinputdocument solrdoc = new solrinputdocument(); solrdoc.addfield("id", "id1"); solrdoc.addfield("letter", "letter"); server.add(solrdoc); server.commit();
what doing wrong?
the trick use preemptive authentication avoid need repeat query after "unauthorized" response sent. here example preemptive basic authentication apache httpclient 4
Comments
Post a Comment