[
https://issues.apache.org/jira/browse/SOLR-10530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15980682#comment-15980682
]
wangyongxin commented on SOLR-10530:
------------------------------------
11:19:07.132 [http-bio-8060-exec-2] ERROR o.a.s.c.s.i.CloudSolrClient - Request
to collection news failed due to (401)
org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error
from server at http://192.168.10.251:8983/solr/news_shard1_replica2: Expected
mime type application/xml but got text/html. <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 401 require authentication</title>
</head>
<body><h2>HTTP ERROR 401</h2>
<p>Problem accessing /solr/news_shard1_replica2/update. Reason:
<pre> require authentication</pre></p>
</body>
</html>
, retry? 0
> Basic Authentication Plugin blockUnknown HTTP ERROR 401 require authentication
> ------------------------------------------------------------------------------
>
> Key: SOLR-10530
> URL: https://issues.apache.org/jira/browse/SOLR-10530
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Affects Versions: 6.4.2
> Environment: linux and mac os
> Reporter: wangyongxin
> Attachments: screenshot-1.png
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> when solr cloud use Basic Authentication Plugin, and set blockUnknown = true,
> set username and password in security.json and solr.in.sh, and my solr
> version is 6.4.2, and i created a collection named "news", changed
> managed-schema and solrconfig.xml in zookeeper cloud, and add a jar named
> ik-analyzer.jar into solr webapp lib directory, restart solr clouds,
> everything seems ok, and I use my java web project connected to zookeepers,
> use codes method like :
> public static QueryResponse getResponseWithAuth(CloudSolrClient solr,
> SolrQuery query) throws SolrServerException, IOException {
> QueryRequest req = new QueryRequest(query);
> req.setBasicAuthCredentials(username, password);
> return req.process(solr);
> }
> search in solr with base authentication is working right ! but when I trying
> to delete or update documents with solr like this:
> public static UpdateResponse deleteWithAuth(CloudSolrClient solr, String id)
> throws SolrServerException, IOException {
> UpdateRequest updateRequest = new UpdateRequest();
> updateRequest.setBasicAuthCredentials(username, password);
> updateRequest.setAction(UpdateRequest.ACTION.COMMIT, false, false);
> updateRequest.deleteById(id);
> return updateRequest.process(solr);
> }
> or update method :
> public static UpdateResponse addWithAuth(CloudSolrClient solr,
> SolrInputDocument doc) throws SolrServerException, IOException {
> UpdateRequest updateRequest = new UpdateRequest();
> updateRequest.setBasicAuthCredentials(username, password);
> updateRequest.setAction(UpdateRequest.ACTION.OPTIMIZE, false, false);
> updateRequest.add(doc);
> return updateRequest.process(solr);
> }
> it returns error like this :
> 11:20:42.450 [http-bio-8060-exec-10] ERROR o.a.s.c.s.i.CloudSolrClient -
> Request to collection news failed due to (401)
> org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error
> from server at http://192.168.10.250:8983/solr/news_shard1_replica1: Expected
> mime type application/xml but got text/html. <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
> <title>Error 401 require authentication</title>
> </head>
> <body><h2>HTTP ERROR 401</h2>
> <p>Problem accessing /solr/news_shard1_replica1/update. Reason:
> <pre> require authentication</pre></p>
> </body>
> </html>
> , retry? 0
> please help me find out where I am wrong ! thanks
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]