Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-15063

Nullpointer Exception in Camel Salesforce

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.2.0
    • Fix Version/s: 3.4.0
    • Component/s: camel-salesforce
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      While working on an integration test for the Camel Kafka Connector, which uses 3.2.0, I found what appears to be a problem in Camel Salesforce.

       

      2020-05-14 17:22:48,758 [ool-68-thread-1] ERROR org.apache.camel.impl.engine.AbstractCamelContext - Error starting CamelContext (camel-1) due to exception thrown: null
      java.lang.NullPointerException: null
       at org.apache.camel.component.salesforce.internal.streaming.SubscriptionHelper.createClient(SubscriptionHelper.java:343) ~[camel-salesforce-3.2.0.jar:3.2.0]
       at org.apache.camel.component.salesforce.internal.streaming.SubscriptionHelper.doStart(SubscriptionHelper.java:111) ~[camel-salesforce-3.2.0.jar:3.2.0]
       at org.apache.camel.support.service.BaseService.start(BaseService.java:115) ~[camel-api-3.2.0.jar:3.2.0]
       at org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:84) ~[camel-api-3.2.0.jar:3.2.0]
       at org.apache.camel.component.salesforce.SalesforceConsumer.doStart(SalesforceConsumer.java:320) ~[camel-salesforce-3.2.0.jar:3.2.0]
       at org.apache.camel.support.service.BaseService.start(BaseService.java:115) ~[camel-api-3.2.0.jar:3.2.0]
       at org.apache.camel.impl.engine.AbstractCamelContext.startService(AbstractCamelContext.java:3056) ~[camel-base-3.2.0.jar:3.2.0]
       at org.apache.camel.impl.engine.AbstractCamelContext.doStartOrResumeRouteConsumers(AbstractCamelContext.java:3394) ~[camel-base-3.2.0.jar:3.2.0]
       at org.apache.camel.impl.engine.AbstractCamelContext.doStartRouteConsumers(AbstractCamelContext.java:3325) ~[camel-base-3.2.0.jar:3.2.0]
       at org.apache.camel.impl.engine.AbstractCamelContext.safelyStartRouteServices(AbstractCamelContext.java:3230) ~[camel-base-3.2.0.jar:3.2.0]
       at org.apache.camel.impl.engine.AbstractCamelContext.doStartOrResumeRoutes(AbstractCamelContext.java:2992) ~[camel-base-3.2.0.jar:3.2.0]
       at org.apache.camel.impl.engine.AbstractCamelContext.doStartCamel(AbstractCamelContext.java:2790) ~[camel-base-3.2.0.jar:3.2.0]
       at org.apache.camel.impl.engine.AbstractCamelContext.doStartContext(AbstractCamelContext.java:2643) [camel-base-3.2.0.jar:3.2.0]
       at org.apache.camel.impl.engine.AbstractCamelContext.doStart(AbstractCamelContext.java:2606) [camel-base-3.2.0.jar:3.2.0]
       at org.apache.camel.support.service.BaseService.start(BaseService.java:115) [camel-api-3.2.0.jar:3.2.0]
       at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2448) [camel-base-3.2.0.jar:3.2.0]
       at org.apache.camel.main.Main.doStart(Main.java:118) [camel-main-3.2.0.jar:3.2.0]
       at org.apache.camel.support.service.BaseService.start(BaseService.java:115) [camel-api-3.2.0.jar:3.2.0]
       at org.apache.camel.main.MainSupport.run(MainSupport.java:83) [camel-main-3.2.0.jar:3.2.0]
       at org.apache.camel.kafkaconnector.utils.CamelMainSupport$CamelContextStarter.run(CamelMainSupport.java:224) [classes/:?]
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]

       

      The problem seems to be related to the following set of conditions.

      1. A SalesforceHTTPClient is not defined: https://github.com/apache/camel/blob/release/3.2.0/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java#L328
      2. Therefore, the default Jetty one would be created: https://github.com/apache/camel/blob/release/3.2.0/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java#L335
      3. Subsequently, the ServiceHelper performs the initialization of the SubscriptionHelper: https://github.com/apache/camel/blob/release/3.2.0/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java#L371
      4. This, eventually, would call the doStart() method of the SubscriptionHelper: https://github.com/apache/camel/blob/399f352a2e1a25d6a8af78d0ff7048c60c659522/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java#L108
      5. Which would try to create the Bayeux client: https://github.com/apache/camel/blob/399f352a2e1a25d6a8af78d0ff7048c60c659522/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java#L111
      6. However, to do so, it tries uses the shared that Jetty HTTP client: https://github.com/apache/camel/blob/399f352a2e1a25d6a8af78d0ff7048c60c659522/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java#L340

       

      The problem is that it tries to use the http client from the SalesforceEndpointConfig instance and, in no point between steps 1 and 6, it seems to have set the instanced created on the step 1 to the instance of that class.

       

       

       

       

       

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                orpiske Otavio Rodolfo Piske
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: