Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-3423

Authenticate Java Driver credential SCRAM-SHA256

    • Type: Icon: Task Task
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.11.0
    • Component/s: Authentication
    • None
    • Environment:
      mongodb-driver:3.11.0 intent connect to server mongo with MongoCredential.createScramSha256Credential()

      I intented connect android app to mongodb with authentication SCRAM-SHA256 but when execute a find() in my collection, throw this exception:

      I/cluster: Cluster created with settings

      {hosts=[mymongoserver.com:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}

      I/art: Rejecting re-init on previously-failed class java.lang.Class<com.mongodb.internal.connection.ScramShaAuthenticator$ScramShaSaslClient>
      Rejecting re-init on previously-failed class java.lang.Class<com.mongodb.internal.connection.ScramShaAuthenticator$ScramShaSaslClient>
      I/connection: Opened connection [connectionId

      {localValue:1, serverValue:9591}

      ] to mymongoserver.com:27017
      I/cluster: Monitor thread successfully connected to server with description ServerDescription{address=mymongoserver.com:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion

      {versionList=[4, 0, 9]}

      , minWireVersion=0, maxWireVersion=7, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=71782969}
      I/art: Rejecting re-init on previously-failed class java.lang.Class<com.mongodb.internal.connection.ScramShaAuthenticator$ScramShaSaslClient>
      I/connection: Closed connection [connectionId

      {localValue:2}

      ] to mymongoserver.com:27017 because there was a socket exception raised by this connection.
      E/com.probando.app.MongoDB: MongoException ->
      com.mongodb.MongoException: java.lang.NoClassDefFoundError: com.mongodb.internal.connection.ScramShaAuthenticator$ScramShaSaslClient
      at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:138)
      at com.mongodb.internal.connection.UsageTrackingInternalConnection.open(UsageTrackingInternalConnection.java:50)
      at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.open(DefaultConnectionPool.java:398)
      at com.mongodb.internal.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:115)
      at com.mongodb.internal.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:101)
      at com.mongodb.internal.connection.DefaultServer.getConnection(DefaultServer.java:92)
      at com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.getConnection(ClusterBinding.java:126)
      at com.mongodb.operation.FindOperation$1.call(FindOperation.java:728)
      at com.mongodb.operation.FindOperation$1.call(FindOperation.java:725)
      at com.mongodb.operation.OperationHelper.withReadConnectionSource(OperationHelper.java:463)
      at com.mongodb.operation.FindOperation.execute(FindOperation.java:725)
      at com.mongodb.operation.FindOperation.execute(FindOperation.java:89)
      at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:189)
      at com.mongodb.client.internal.MongoIterableImpl.execute(MongoIterableImpl.java:143)
      at com.mongodb.client.internal.MongoIterableImpl.iterator(MongoIterableImpl.java:92)
      at com.mongodb.client.internal.MongoIterableImpl.forEach(MongoIterableImpl.java:121)
      at com.mongodb.client.internal.MongoIterableImpl.into(MongoIterableImpl.java:133)
      at com.probando.app.MongoDB.GetDocumentos(MongoDB.java:129)
      at com.probando.app.MongoActivity$GetDocumentos.doInBackground(MongoActivity.java:58)
      at com.probando.app.MongoActivity$GetDocumentos.doInBackground(MongoActivity.java:54)
      at android.os.AsyncTask$2.call(AsyncTask.java:288)
      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
      at java.lang.Thread.run(Thread.java:818)
      Caused by: java.lang.NoClassDefFoundError: com.mongodb.internal.connection.ScramShaAuthenticator$ScramShaSaslClient
      at com.mongodb.internal.connection.ScramShaAuthenticator.createSaslClient(ScramShaAuthenticator.java:77)
      at com.mongodb.internal.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:50)
      at com.mongodb.internal.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:47)
      at com.mongodb.internal.connection.SaslAuthenticator.doAsSubject(SaslAuthenticator.java:179)
      at com.mongodb.internal.connection.SaslAuthenticator.authenticate(SaslAuthenticator.java:47)
      at com.mongodb.internal.connection.InternalStreamConnectionInitializer.authenticateAll(InternalStreamConnectionInitializer.java:156)
      at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:63)
      at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:129)
      at com.mongodb.internal.connection.UsageTrackingInternalConnection.open(UsageTrackingInternalConnection.java:50) 
      at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.open(DefaultConnectionPool.java:398) 
      at com.mongodb.internal.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:115) 
      at com.mongodb.internal.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:101) 
      at com.mongodb.internal.connection.DefaultServer.getConnection(DefaultServer.java:92) 
      at com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.getConnection(ClusterBinding.java:126) 
      at com.mongodb.operation.FindOperation$1.call(FindOperation.java:728) 
      at com.mongodb.operation.FindOperation$1.call(FindOperation.java:725) 
      at com.mongodb.operation.OperationHelper.withReadConnectionSource(OperationHelper.java:463) 
      at com.mongodb.operation.FindOperation.execute(FindOperation.java:725) 
      at com.mongodb.operation.FindOperation.execute(FindOperation.java:89) 
      at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:189) 
      at com.mongodb.client.internal.MongoIterableImpl.execute(MongoIterableImpl.java:143) 
      at com.mongodb.client.internal.MongoIterableImpl.iterator(MongoIterableImpl.java:92) 
      at com.mongodb.client.internal.MongoIterableImpl.forEach(MongoIterableImpl.java:121) 
      at com.mongodb.client.internal.MongoIterableImpl.into(MongoIterableImpl.java:133) 
      at com.probando.app.MongoDB.GetDocumentos(MongoDB.java:129) 
      at com.probando.app.MongoActivity$GetDocumentos.doInBackground(MongoActivity.java:58) 
      at com.probando.app.MongoActivity$GetDocumentos.doInBackground(MongoActivity.java:54) 
      at android.os.AsyncTask$2.call(AsyncTask.java:288) 
      at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
      at java.lang.Thread.run(Thread.java:818) 
      I/cluster: Cluster created with settings

      {hosts=[mymongoserver.com:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}

      PD: I using org.mongodb:mongodb-driver:3.11.0 and a MongoCollection<BasicDBObject>

      Thanks for you attention 

            Assignee:
            Unassigned Unassigned
            Reporter:
            johana.reza.25@gmail.com Johana Reza
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: