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 Zheng Lin Edwin Yeo <ed...@gmail.com> on 2017/04/12 04:09:38 UTC
NonRepeatableRequestException Error during indexing after setting up
Basic Authentication
Hi,
I'm getting an error with indexing using SolrJ after setting up the Basic
Authentication with the following code.
Credentials defaultcreds = new UsernamePasswordCredentials("id",
"password");
appendAuthentication(defaultcreds, "BASIC", solr);
private static void appendAuthentication(Credentials credentials, String
authPolicy, SolrClient solrClient) {
// if (isHttpSolrClient(solrClient)) {
HttpSolrClient httpSolrClient = (HttpSolrClient) solrClient;
// if (credentials != null && StringUtils.isNotBlank(authPolicy)
// && assertHttpClientInstance(httpSolrClient.getHttpClient())) {
AbstractHttpClient httpClient = (AbstractHttpClient)
httpSolrClient.getHttpClient();
httpClient.getCredentialsProvider().setCredentials(new
AuthScope(AuthScope.ANY), credentials);
httpClient.getParams().setParameter(AuthPNames.TARGET_AUTH_PREF,
Arrays.asList(authPolicy));
// }
// }
}
The is the error message that I got.
org.apache.solr.client.solrj.SolrServerException: IOException occured when
talking to server at: http://localhost:8983/edm/chinaSapSo
at
org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:624)
at
org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:279)
at
org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:268)
at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:149)
at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:106)
at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:71)
at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:85)
at testing.indexing(testing.java:2848)
at testing.main(testing.java:265)
Caused by: org.apache.http.client.ClientProtocolException
at
org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:839)
at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
at
org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:515)
... 8 more
Caused by: org.apache.http.client.NonRepeatableRequestException: Cannot
retry request with a non-repeatable request entity.
at
org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:662)
at
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:486)
at
org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:835)
... 11 more
The error occurs at the part where I do the adding of the index to Solr
solr.add(batch);
This is what is defined for "solr".
static SolrClient solr;
solr = new HttpSolrClient( SOLR_URL );
What could be the reason for this? Is there anything wrong with my code?
I'm using SolrCloud on Solr 6.4.2.
Regards,
Edwin