我試圖用使用下面的代碼SolrJ API SolrCloud連接:Solr6.3.0 SolrJ API的基本身份驗證
String zkHostString = "localhost:9983";
String USER = "solr";
String PASSWORD = "SolrRocks";
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(USER, PASSWORD));
CloseableHttpClient httpClient = HttpClientBuilder.create().setDefaultCredentialsProvider(credentialsProvider).build();
CloudSolrClient solr = new CloudSolrClient.Builder().withZkHost(zkHostString).withHttpClient(httpClient).build();
((CloudSolrClient)solr).setDefaultCollection("gettingstarted");
但是,讓誤差:在線程 「主要」 org.apache
例外。 solr.client.solrj.impl.CloudSolrClient $ RouteException:與服務器通話時發生IOException:http://192.168.0.104:8983/solr/gettingstarted_shard2_replica1 at org.apache.solr.client.solrj.impl.CloudSolrClient.directUpdate(CloudSolrClient.java:767) at org.apache .solr.client.solrj.impl.CloudSolrClient.sendRequest(CloudSolrClient.java:1173) at org.apache.solr.client.solrj.impl.CloudSolrClient.requestWithRetryOnStaleState(CloudSolrClient.java:1062) at org.apache.solr.client.solrj.impl.CloudSolrClient.request(CloudSolrClient.java:1004) at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:149) at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:173) at org.apache.solr。 client.solrj.SolrClient.add(SolrClient.java:190) at com.app.graphiti.TextParser.main(TextParser.java:92) 引起:org.apache.solr.client.solrj.SolrServerException:發生IOException當與服務器交談時:http://192.168.0.104:8983/solr/gettingstarted_shard2_replica1 at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:607) at org.apache.solr.client.solrj.impl.H ttpSolrClient.request(HttpSolrClient.java:262) at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:251) at org.apache.solr.client.solrj.impl.LBHttpSolrClient。 doRequest(LBHttpSolrClient.java:435) at org.apache.solr.client.solrj.impl.LBHttpSolrClient.request(LBHttpSolrClient.java:387) at org.apache.solr.client.solrj.impl.CloudSolrClient.lambda $ directUpdate $ 0(CloudSolrClient.java:742) at java.util.concurrent.FutureTask.run(Unknown Source) at org.apache.solr.common.util.ExecutorUtil $ MDCAwareThreadPoolExecutor.lambda $ execute $ 0(ExecutorUtil.java:229 ) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) 引起人:org.apache.http.client.ClientProtocolException at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55) at org.apache.solr。 client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:498) ... 10更多 引起:org.apache.http.client.NonRepeatableRequestException:無法重試請求與不可重複的請求實體。 at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:225) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) at org.apache。 http.impl.execchain.RetryExec.execute(RetryExec.java:88) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) at org.apache.http.impl.client。 InternalHttpClient.doExecute(InternalHttpClient.java:184) ... 13 more 16:55:40.289 [main-SendThread(0:0:0:0:0:0:0:1:9983)] DEBUG org.apache .zookeeper.ClientCnxn - 在1ms後得到對sessionid:0x15a3bc76e1f000e的ping響應 16:55:43.624 [main-SendThread(0:0:0:0:0:0:0:1:9983)] DEBUG org.apache.zookeeper .ClientCnxn - 在1ms後獲得了sessionid的響應:0x15a3bc76e1f000e 16:55:46.958 [main-SendThread(0:0:0:0:0:0:0:1:9983)] DEBUG org.apache.zookeeper。ClientCnxn - 在1ms後得到了對sessionid:0x15a3bc76e1f000e的ping響應 \
請幫忙。 Vrinda Davda