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

Can't run mongo-db-source kamelet route with non-admin user - Failed to start route mongodb-source-1 because of null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Major Major
    • camel-k-1.6-GA
    • None
    • Camel-K
    • None
    • False
    • False
    • % %
    • CK2
    • Todo
    • Undefined
    • Hide

      1. run mongodb (attached mongo-deploymentconfig.yaml)

      2. mongodb service (attached mongo-service.yaml)

      3. create mongodb collection - connect to mongodb pod and create capped collection db.createCollection("test", {capped: true, size: 5242880})

      4. create mongo-db route (attached - KameletRoute.java)

      5. observe the error in the integration pod

      Show
      1. run mongodb (attached mongo-deploymentconfig.yaml) 2. mongodb service (attached mongo-service.yaml) 3. create mongodb collection - connect to mongodb pod and create capped collection db.createCollection("test", {capped: true, size: 5242880}) 4. create mongo-db route (attached - KameletRoute.java) 5. observe the error in the integration pod

      Using mongodb-source.kamelet.yaml kamelet in latest camel-k CK7 build
      Hit an issue trying to run following route with non-admin user:

      // camel-k: language=java
      package com.test;
      
      import org.apache.camel.builder.RouteBuilder;
      
      /**
       * Simple route that logs the body from any specified endpoint.
       */
      public class KameletRoute extends RouteBuilder {
      
          final String logMessage = "${body}";
      
          @Override
          public void configure() throws Exception {
              from("kamelet:mongodb-source?hosts=x.x.x.x:27017&username=user&password=user&collection=test&database=test&persistentTailTracking=false")
              .log(logMessage);
          }
      }
      

      The same issue is present in case I try the kamelet binding mongodb-to-log with non-admin user credentials. The flow-binding.yaml is also attached together with the full log (kameletbinding_pod_log.txt)

      The mongo-db runs on openshift - configuration files are attached.

      The exception (see full pod_log.txt in attachements):

      2021-07-26 12:21:49,005 INFO  [org.mon.dri.connection] (main) Closed connection [connectionId{localValue:7}] to 172.30.109.154:27017 because there was a socket exception raised by this connection.
      2021-07-26 12:21:49,007 ERROR [org.apa.cam.imp.eng.AbstractCamelContext] (main) Error starting CamelContext (camel-1) due to exception thrown: Failed to start route mongodb-source-1 because of null: org.apache.camel.FailedToStartRouteException: Failed to start route mongodb-source-1 because of null
      	at org.apache.camel.impl.engine.RouteService.setUp(RouteService.java:132)
      	at org.apache.camel.impl.engine.InternalRouteStartupManager.doWarmUpRoutes(InternalRouteStartupManager.java:305)
      	at org.apache.camel.impl.engine.InternalRouteStartupManager.safelyStartRouteServices(InternalRouteStartupManager.java:189)
      	at org.apache.camel.impl.engine.InternalRouteStartupManager.doStartOrResumeRoutes(InternalRouteStartupManager.java:147)
      	at org.apache.camel.impl.engine.AbstractCamelContext.doStartCamel(AbstractCamelContext.java:3166)
      	at org.apache.camel.impl.engine.AbstractCamelContext.doStartContext(AbstractCamelContext.java:2846)
      	at org.apache.camel.impl.engine.AbstractCamelContext.doStart(AbstractCamelContext.java:2797)
      	at org.apache.camel.support.service.BaseService.start(BaseService.java:119)
      	at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2494)
      	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:245)
      	at org.apache.camel.quarkus.main.CamelMain.doStart(CamelMain.java:94)
      	at org.apache.camel.support.service.BaseService.start(BaseService.java:119)
      	at org.apache.camel.quarkus.main.CamelMain.startEngine(CamelMain.java:139)
      	at org.apache.camel.quarkus.main.CamelMainRuntime.start(CamelMainRuntime.java:49)
      	at org.apache.camel.quarkus.core.CamelBootstrapRecorder.start(CamelBootstrapRecorder.java:45)
      	at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot-173480958.deploy_0(CamelBootstrapProcessor$boot-173480958.zig:101)
      	at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot-173480958.deploy(CamelBootstrapProcessor$boot-173480958.zig:40)
      	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:697)
      	at io.quarkus.runtime.Application.start(Application.java:90)
      	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:97)
      	at io.quarkus.runtime.Quarkus.run(Quarkus.java:66)
      	at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
      	at io.quarkus.runtime.Quarkus.run(Quarkus.java:119)
      	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
      	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 io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:48)
      	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:25)
      Caused by: com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='user', source='admin', password=<hidden>, mechanismProperties=<hidden>}
      	at com.mongodb.internal.connection.SaslAuthenticator.wrapException(SaslAuthenticator.java:235)
      	at com.mongodb.internal.connection.SaslAuthenticator.getNextSaslResponse(SaslAuthenticator.java:130)
      	at com.mongodb.internal.connection.SaslAuthenticator.access$100(SaslAuthenticator.java:43)
      	at com.mongodb.internal.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:57)
      	at com.mongodb.internal.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:51)
      	at com.mongodb.internal.connection.SaslAuthenticator.doAsSubject(SaslAuthenticator.java:241)
      	at com.mongodb.internal.connection.SaslAuthenticator.authenticate(SaslAuthenticator.java:51)
      	at com.mongodb.internal.connection.DefaultAuthenticator.authenticate(DefaultAuthenticator.java:53)
      	at com.mongodb.internal.connection.InternalStreamConnectionInitializer.authenticate(InternalStreamConnectionInitializer.java:168)
      	at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:63)
      	at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:144)
      	at com.mongodb.internal.connection.UsageTrackingInternalConnection.open(UsageTrackingInternalConnection.java:51)
      	at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.open(DefaultConnectionPool.java:431)
      	at com.mongodb.internal.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:115)
      	at com.mongodb.internal.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:100)
      	at com.mongodb.internal.connection.DefaultServer.getConnection(DefaultServer.java:92)
      	at com.mongodb.internal.binding.ClusterBinding$ClusterBindingConnectionSource.getConnection(ClusterBinding.java:119)
      	at com.mongodb.client.internal.ClientSessionBinding$SessionBindingConnectionSource.getConnection(ClientSessionBinding.java:135)
      	at com.mongodb.internal.operation.ListCollectionsOperation$1.call(ListCollectionsOperation.java:233)
      	at com.mongodb.internal.operation.ListCollectionsOperation$1.call(ListCollectionsOperation.java:230)
      	at com.mongodb.internal.operation.OperationHelper.withReadConnectionSource(OperationHelper.java:582)
      	at com.mongodb.internal.operation.ListCollectionsOperation.execute(ListCollectionsOperation.java:230)
      	at com.mongodb.internal.operation.ListCollectionsOperation.execute(ListCollectionsOperation.java:86)
      	at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:178)
      	at com.mongodb.client.internal.MongoIterableImpl.execute(MongoIterableImpl.java:135)
      	at com.mongodb.client.internal.MongoIterableImpl.iterator(MongoIterableImpl.java:92)
      	at com.mongodb.client.internal.MappingIterable.iterator(MappingIterable.java:39)
      	at com.mongodb.client.internal.MappingIterable.iterator(MappingIterable.java:27)
      	at java.base/java.lang.Iterable.spliterator(Iterable.java:101)
      	at org.apache.camel.component.mongodb.MongoDbEndpoint.databaseContainsCollection(MongoDbEndpoint.java:278)
      	at org.apache.camel.component.mongodb.MongoDbEndpoint.initializeConnection(MongoDbEndpoint.java:255)
      	at org.apache.camel.component.mongodb.MongoDbEndpoint.createConsumer(MongoDbEndpoint.java:152)
      	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)
      	... 29 more
      Caused by: com.mongodb.MongoCommandException: Command failed with error 18 (AuthenticationFailed): 'Authentication failed.' on server 172.30.109.154:27017. The full response is {"operationTime": {"$timestamp": {"t": 1627302103, "i": 1}}, "ok": 0.0, "errmsg": "Authentication failed.", "code": 18, "codeName": "AuthenticationFailed", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1627302103, "i": 1}}, "signature": {"hash": {"$binary": {"base64": "7gegCjtck79ot6EIEUGS2BuXmIE=", "subType": "00"}}, "keyId": 6989202123321769989}}}
      	at com.mongodb.internal.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:175)
      	at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:359)
      	at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:280)
      	at com.mongodb.internal.connection.CommandHelper.sendAndReceive(CommandHelper.java:83)
      	at com.mongodb.internal.connection.CommandHelper.executeCommand(CommandHelper.java:33)
      	at com.mongodb.internal.connection.SaslAuthenticator.sendSaslStart(SaslAuthenticator.java:191)
      	at com.mongodb.internal.connection.SaslAuthenticator.getNextSaslResponse(SaslAuthenticator.java:128)
      	... 64 more
      
      

        1. pod_log.txt
          39 kB
        2. mongo-service.yaml
          0.2 kB
        3. mongo-deploymentconfig.yaml
          2 kB
        4. mongodb.yaml
          2 kB
        5. KameletRoute.java
          0.7 kB
        6. kameletbinding_pod_log.txt
          40 kB
        7. flow-binding.yaml
          0.5 kB

              Unassigned Unassigned
              tplevko@redhat.com Tomas Plevko
              Tomas Plevko Tomas Plevko
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: