Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
401 (not authorized) error thrown when connecting to SOLR 9 cluster using SolrJ with basic authentication.
Caused by: org.apache.solr.client.solrj.impl.BaseHttpSolrClient$RemoteSolrException: Error from server at http://solr3:8983/solr: Expected mime type in [application/octet-stream, application/vnd.apache.solr.javabin] but got text/html. <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/> <title>Error 401 require authentication</title> </head> <body><h2>HTTP ERROR 401 require authentication</h2> <table> <tr><th>URI:</th><td>/solr/admin/collections</td></tr> <tr><th>STATUS:</th><td>401</td></tr> <tr><th>MESSAGE:</th><td>require authentication</td></tr> <tr><th>SERVLET:</th><td>default</td></tr> </table> </body> </html> at org.apache.solr.client.solrj.impl.Http2SolrClient.processErrorsAndResponse(Http2SolrClient.java:835) at org.apache.solr.client.solrj.impl.Http2SolrClient.processErrorsAndResponse(Http2SolrClient.java:548) at org.apache.solr.client.solrj.impl.Http2SolrClient.request(Http2SolrClient.java:507) at org.apache.solr.client.solrj.SolrClient.request(SolrClient.java:1193) at org.apache.solr.client.solrj.impl.BaseHttpClusterStateProvider.fetchLiveNodes(BaseHttpClusterStateProvider.java:227) at org.apache.solr.client.solrj.impl.BaseHttpClusterStateProvider.init(BaseHttpClusterStateProvider.java:63) at org.apache.solr.client.solrj.impl.Http2ClusterStateProvider.<init>(Http2ClusterStateProvider.java:32) at org.apache.solr.client.solrj.impl.CloudHttp2SolrClient$Builder.build(CloudHttp2SolrClient.java:392) ... 113 common frames omitted
when Http2ClusterStateProvider is trying to get live nodes, builder build() method that creates initialClient instanse to get list of nodes, ignores base authentication string provided in httpClient instance:
protected SolrClient getSolrClient(String baseUrl)
{ return new Http2SolrClient.Builder(baseUrl).withHttpClient(httpClient).build(); }httpClient basicAuthAuthorizationStr lost here - field is not used in build() method.
Attachments
Issue Links
- links to