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

CloudSolrClient executes select calls but not updates after adding authentication

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Invalid
    • 8.5
    • None
    • SolrCloud

    Description

      I'm trying to upgrade from 8.3.1 to 8.5.0 and I was forced to enable authorization and authentication (set the file /security.json in zk) and I also reuploaded the configset via the API with credentials:

      	{
      	"authentication":{ 
      	   "blockUnknown": true, 
      	   "class":"solr.BasicAuthPlugin",
      	   "credentials":{"solr":"fAOsiVaz+IMaWzzypxvbOsTgA4YC0m0PPymQH09T5Vs= 0DJIpGUbCUHtEr4NvF6Lluyd1en0cHgGsQLiUYYyphU="}, 
      	   "realm":"My Solr users",
      	   "forwardCredentials": true
      	},
      	"authorization":{
      	   "class":"solr.RuleBasedAuthorizationPlugin",
      	   "permissions":[{"name":"all","role":"admin"}], 
      	   "user-role":{"solr":"admin"} 
      	}}
      

      In my solr client config I have (the httpClient is now supplied to the builder so it can be in charge of applying the basic credentials to each call):

              final ModifiableSolrParams params = new ModifiableSolrParams();
              params.set("followRedirects", false);
              params.set("allowCompression", false);
              params.set("httpBasicAuthUser", solrUser);
              params.set("httpBasicAuthPassword", solrPass);
              CloseableHttpClient httpClient = HttpClientUtil.createClient( params);
      	final CloudSolrClient client = new CloudSolrClient.Builder( zkHosts,Optional.empty() )
      			.withHttpClient(httpClient)
      			.build();
      
      	client.setZkClientTimeout( 30000 );
      	return client;
      

      Now, all the select calls (reads) are working via this client. However when I try to add new documents to a collection:

      	...
      	solrClient.add(collName, docs);
      	...
      

      I get this exception:

      	org.apache.solr.client.solrj.impl.CloudSolrClient$RouteException: IOException occurred when talking to server at: http://192.168.2.159:8983/solr/coreTgy_shard1_replica_n1
      		at org.apache.solr.client.solrj.impl.CloudSolrClient.getRouteException(CloudSolrClient.java:125)
      		at org.apache.solr.client.solrj.impl.CloudSolrClient.getRouteException(CloudSolrClient.java:46)
      		at org.apache.solr.client.solrj.impl.BaseCloudSolrClient.directUpdate(BaseCloudSolrClient.java:559)
      		at org.apache.solr.client.solrj.impl.BaseCloudSolrClient.sendRequest(BaseCloudSolrClient.java:1046)
      		at org.apache.solr.client.solrj.impl.BaseCloudSolrClient.requestWithRetryOnStaleState(BaseCloudSolrClient.java:906)
      		at org.apache.solr.client.solrj.impl.BaseCloudSolrClient.request(BaseCloudSolrClient.java:838)
      		at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:211)
      		at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:106)
      		at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:71)
      		at com.sytrue.nlp.tgy.impl.SolrTgyEngine.saveConcept(SolrTgyEngine.java:1109)
      		at com.sytrue.nlp.tgy.mtn.impl.SolrTgyMtnImpl.removeConceptTerm(SolrTgyMtnImpl.java:429)
      		at com.sytrue.nlp.tgy.mtn.impl.SolrTgyMtnImpl.processTermAlteration(SolrTgyMtnImpl.java:91)
      		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      		at org.apache.camel.support.ObjectHelper.invokeMethodSafe(ObjectHelper.java:207)
      		at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:421)
      		at org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:242)
      		at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:213)
      		at org.apache.camel.component.bean.AbstractBeanProcessor.process(AbstractBeanProcessor.java:148)
      		at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:55)
      		at org.apache.camel.component.bean.BeanProducer.process(BeanProducer.java:41)
      		at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:134)
      		at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryState.run(RedeliveryErrorHandler.java:476)
      		at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:185)
      		at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:59)
      		at org.apache.camel.processor.Pipeline.process(Pipeline.java:87)
      		at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:228)
      		at org.apache.camel.impl.engine.DefaultAsyncProcessorAwaitManager.process(DefaultAsyncProcessorAwaitManager.java:78)
      		at org.apache.camel.support.AsyncProcessorSupport.process(AsyncProcessorSupport.java:40)
      		at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:129)
      		at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:736)
      		at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:696)
      		at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:674)
      		at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:318)
      		at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:245)
      		at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1189)
      		at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1179)
      		at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1076)
      		at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      		at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      		at java.base/java.lang.Thread.run(Thread.java:834)
      	Caused by: org.apache.solr.client.solrj.SolrServerException: IOException occurred when talking to server at: http://192.168.2.159:8983/solr/coreTgy_shard1_replica_n1
      		at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:679)
      		at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:265)
      		at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:248)
      		at org.apache.solr.client.solrj.impl.LBSolrClient.doRequest(LBSolrClient.java:368)
      		at org.apache.solr.client.solrj.impl.LBSolrClient.request(LBSolrClient.java:296)
      		at org.apache.solr.client.solrj.impl.BaseCloudSolrClient.lambda$directUpdate$0(BaseCloudSolrClient.java:533)
      		at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      		at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:210)
      		... 3 more
      

      I think there might be an issue when the /update path is used in combination with basic authentication and POST method in which the "/update" portion is not added to the URL.
      What I'm trying to say is that the url should have been http://192.168.2.159:8983/solr/coreTgy_shard1_replica_n1/update

      Attachments

        Activity

          People

            Unassigned Unassigned
            biliboc Constantin Mitocaru
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: