Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-16291

Azure Storage Queue: Camel startup fails due to null client in 3.9.0

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: Camel-K-GA, 2021-M4
    • Component/s: Camel-3, Camel-K
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      1. replace placeholders in MyRouteBuilder.java
      2. run with mvn compile camel:run

      Show
      1. replace placeholders in MyRouteBuilder.java 2. run with mvn compile camel:run
    • QE Test Coverage:
      +
    • Regression Test:
      Automated

      Description

      According to the doc I should be able to make it work only by specifying accountName and accessKey:

      Provide accountName and accessKey for your Azure account, this is the simplest way to get started. The accessKey can be generated through your Azure portal.
      

      This doesn't work with 3.9.0 as it fails at runtime with:

      [INFO] Starting Camel ...
      [ com.test.MyApplication.main()] BaseMainSupport                INFO  Calling configure method on configuration class: com.test.MyConfiguration
      [ com.test.MyApplication.main()] BaseMainSupport                INFO  Auto-configuration summary
      [ com.test.MyApplication.main()] BaseMainSupport                INFO      camel.main.name=MyTimerCamel
      [ com.test.MyApplication.main()] BaseMainSupport                INFO      camel.main.jmxEnabled=false
      [ com.test.MyApplication.main()] QueueComponent                 INFO  No QueueServiceClient instance in the registry
      [ERROR] *************************************
      [ERROR] Error occurred while running main from: com.test.MyApplication
      [ERROR] 
      java.lang.reflect.InvocationTargetException
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
          at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:566)
          at org.apache.camel.maven.RunMojo$1.run (RunMojo.java:438)
          at java.lang.Thread.run (Thread.java:834)
      Caused by: org.apache.camel.FailedToStartRouteException: Failed to start route route1 because of null
          at org.apache.camel.impl.engine.RouteService.setUp (RouteService.java:132)
          at org.apache.camel.impl.engine.InternalRouteStartupManager.doInitRoutes (InternalRouteStartupManager.java:92)
          at org.apache.camel.impl.engine.AbstractCamelContext.doInit (AbstractCamelContext.java:2773)
          at org.apache.camel.support.service.BaseService.init (BaseService.java:83)
          at org.apache.camel.impl.engine.AbstractCamelContext.init (AbstractCamelContext.java:2490)
          at org.apache.camel.support.service.BaseService.start (BaseService.java:111)
          at org.apache.camel.impl.engine.AbstractCamelContext.start (AbstractCamelContext.java:2507)
          at org.apache.camel.impl.DefaultCamelContext.start (DefaultCamelContext.java:174)
          at org.apache.camel.main.Main.doStart (Main.java:116)
          at org.apache.camel.support.service.BaseService.start (BaseService.java:115)
          at org.apache.camel.main.MainSupport.run (MainSupport.java:68)
          at org.apache.camel.main.MainCommandLineSupport.run (MainCommandLineSupport.java:169)
          at com.test.MyApplication.main (MyApplication.java:22)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
          at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:566)
          at org.apache.camel.maven.RunMojo$1.run (RunMojo.java:438)
          at java.lang.Thread.run (Thread.java:834)
      Caused by: java.lang.NullPointerException
          at org.apache.camel.component.azure.storage.queue.QueueConsumer.<init> (QueueConsumer.java:53)
          at org.apache.camel.component.azure.storage.queue.QueueEndpoint.createConsumer (QueueEndpoint.java:59)
          at org.apache.camel.impl.engine.DefaultRoute.gatherRootServices (DefaultRoute.java:593)
          at org.apache.camel.impl.engine.DefaultRoute.gatherServices (DefaultRoute.java:577)
          at org.apache.camel.impl.engine.DefaultRoute.initializeServices (DefaultRoute.java:162)
          at org.apache.camel.impl.engine.RouteService.doSetup (RouteService.java:151)
          at org.apache.camel.impl.engine.RouteService.setUp (RouteService.java:130)
          at org.apache.camel.impl.engine.InternalRouteStartupManager.doInitRoutes (InternalRouteStartupManager.java:92)
          at org.apache.camel.impl.engine.AbstractCamelContext.doInit (AbstractCamelContext.java:2773)
          at org.apache.camel.support.service.BaseService.init (BaseService.java:83)
          at org.apache.camel.impl.engine.AbstractCamelContext.init (AbstractCamelContext.java:2490)
          at org.apache.camel.support.service.BaseService.start (BaseService.java:111)
          at org.apache.camel.impl.engine.AbstractCamelContext.start (AbstractCamelContext.java:2507)
          at org.apache.camel.impl.DefaultCamelContext.start (DefaultCamelContext.java:174)
          at org.apache.camel.main.Main.doStart (Main.java:116)
          at org.apache.camel.support.service.BaseService.start (BaseService.java:115)
          at org.apache.camel.main.MainSupport.run (MainSupport.java:68)
          at org.apache.camel.main.MainCommandLineSupport.run (MainCommandLineSupport.java:169)
          at com.test.MyApplication.main (MyApplication.java:22)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
          at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:566)
          at org.apache.camel.maven.RunMojo$1.run (RunMojo.java:438)
          at java.lang.Thread.run (Thread.java:834)
      [ERROR] *************************************
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time:  1.342 s
      [INFO] Finished at: 2021-04-23T14:11:00+02:00
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.apache.camel:camel-maven-plugin:3.9.0:run (default-cli) on project azure-queue-to-log: null: MojoExecutionException: InvocationTargetException: Failed to start route route1 because of null: NullPointerException -> [Help 1]
      [ERROR] 
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR] 
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
      
      

      but the same integration works ok with 3.7.0:

      [INFO] Starting Camel ...
      [ com.test.MyApplication.main()] BaseMainSupport                INFO  Using properties from: classpath:application.properties;optional=true
      [ com.test.MyApplication.main()] BaseMainSupport                INFO  Calling configure method on configuration class: com.test.MyConfiguration
      [ com.test.MyApplication.main()] BaseMainSupport                INFO  Auto-configuration summary:
      [ com.test.MyApplication.main()] BaseMainSupport                INFO  	camel.main.name=MyTimerCamel
      [ com.test.MyApplication.main()] BaseMainSupport                INFO  	camel.main.jmxEnabled=false
      [ com.test.MyApplication.main()] DefaultRoutesCollector         INFO  No additional Camel XML routes discovered from: classpath:camel/*.xml
      [ com.test.MyApplication.main()] DefaultRoutesCollector         INFO  No additional Camel XML route templates discovered from: classpath:camel-template/*.xml
      [ com.test.MyApplication.main()] DefaultRoutesCollector         INFO  No additional Camel XML rests discovered from: classpath:camel-rest/*.xml
      [ com.test.MyApplication.main()] QueueComponent                 INFO  No QueueServiceClient instance in the registry
      [ com.test.MyApplication.main()] AbstractCamelContext           INFO  Apache Camel 3.7.0 (MyTimerCamel) is starting
      [ com.test.MyApplication.main()] AbstractCamelContext           INFO  StreamCaching is not in use. If using streams then it's recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
      [ com.test.MyApplication.main()] InternalRouteStartupManager    INFO  Route: route1 started and consuming from: azure-storage-queue://tnb/azurestorageitcase1619180097826
      [ com.test.MyApplication.main()] AbstractCamelContext           INFO  Total 1 routes, of which 1 are started
      [ com.test.MyApplication.main()] AbstractCamelContext           INFO  Apache Camel 3.7.0 (MyTimerCamel) started in 209ms
      [zurestorageitcase1619180097826] route1                         INFO  {"message": "AzureStorageTest 0"}
      [zurestorageitcase1619180097826] route1                         INFO  {"message": "AzureStorageTest 1"}
      [zurestorageitcase1619180097826] route1                         INFO  {"message": "AzureStorageTest 2"}
      [zurestorageitcase1619180097826] route1                         INFO  {"message": "AzureStorageTest 3"}
      [zurestorageitcase1619180097826] route1                         INFO  {"message": "AzureStorageTest 4"}
      [zurestorageitcase1619180097826] route1                         INFO  {"message": "AzureStorageTest 5"}
      [zurestorageitcase1619180097826] route1                         INFO  {"message": "AzureStorageTest 6"}
      [zurestorageitcase1619180097826] route1                         INFO  {"message": "AzureStorageTest 7"}
      [zurestorageitcase1619180097826] route1                         INFO  {"message": "AzureStorageTest 8"}
      [zurestorageitcase1619180097826] route1                         INFO  {"message": "AzureStorageTest 9"}
      

      In both cases the route is the same:

      public class MyRouteBuilder extends RouteBuilder {    
        @Override       
        public void configure() throws Exception {    
          from("azure-storage-queue://<account>/<queue>?access-key=<accesskey>").log("${body}");    
        }                                          
      }
      

        Attachments

        1. 3.7.0.zip
          6 kB
        2. 3.9.0.zip
          6 kB

          Issue Links

            Activity

              People

              Assignee:
              oscerd Andrea Cosentino
              Reporter:
              avano Andrej Vano
              Tester:
              Andrej Vano Andrej Vano
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: