Andrei Minin created SOLR-16737:
-----------------------------------

             Summary: SOLR 9.2.0 cluster basic authentication with http2 solr 
client
                 Key: SOLR-16737
                 URL: https://issues.apache.org/jira/browse/SOLR-16737
             Project: Solr
          Issue Type: Bug
      Security Level: Public (Default Security Level. Issues are Public)
          Components: SolrJ
    Affects Versions: 9.2
            Reporter: Andrei Minin


401 (not authorized) error thrown when connecting to SOLR 9 cluster using SolrJ 
with basic authentication.
{code:java}
 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 {code}
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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to