Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-16737

SOLR 9.2.0 cluster basic authentication with http2 solr client

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • main (10.0), 9.3
    • SolrJ
    • 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

          Activity

            People

              tflobbe Tomas Eduardo Fernandez Lobbe
              aminin@intellective.com Andrei Minin
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 20m
                  1h 20m