MongoDB Driver connection issue

asked 2018-06-06 10:49:48 -0500

medmehdi gravatar image

updated 2018-06-06 12:45:38 -0500

metadaddy gravatar image

Hello community,

I'm attempting to connect streamsets to a MongoDB instance in order to load data into a Cloudera HDFS. The process seemed straight-forward until I tried to validate the pipeline. I get an error related to the SASL authentication mechanism, likely due to missing java libraries (seems like the SecretKeyFactory class or something similar is missing). The error reads (exception log):

com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=null, userName='datalakereader', source='OCPDCS', password=<hidden>, mechanismProperties={}}
    at com.mongodb.connection.SaslAuthenticator.wrapException(
    at com.mongodb.connection.SaslAuthenticator.access$200(
    at com.mongodb.connection.SaslAuthenticator$
    at com.mongodb.connection.SaslAuthenticator$
    at com.mongodb.connection.SaslAuthenticator.doAsSubject(
    at com.mongodb.connection.SaslAuthenticator.authenticate(
    at com.mongodb.connection.DefaultAuthenticator.authenticate(
    at com.mongodb.connection.InternalStreamConnectionInitializer.authenticateAll(
    at com.mongodb.connection.InternalStreamConnectionInitializer.initialize(
    at com.mongodb.connection.DefaultServerMonitor$
Caused by: Unable to find PBKDF2WithHmacSHA1. [Caused by PBKDF2WithHmacSHA1 SecretKeyFactory not available]
    at com.mongodb.connection.ScramSha1Authenticator$ScramSha1SaslClient.hi(
    at com.mongodb.connection.ScramSha1Authenticator$ScramSha1SaslClient.computeClientFinalMessage(
    at com.mongodb.connection.ScramSha1Authenticator$ScramSha1SaslClient.evaluateChallenge(
    at com.mongodb.connection.SaslAuthenticator$
    ... 9 more
Caused by: PBKDF2WithHmacSHA1 SecretKeyFactory not available
    at javax.crypto.SecretKeyFactory.<init>(
    at javax.crypto.SecretKeyFactory.getInstance(
    at com.mongodb.connection.ScramSha1Authenticator$ScramSha1SaslClient.hi(
    ... 12 more

Any idea how I can quickly remedy the situation?

Thank you very much!

edit retag flag offensive close merge delete


This might be as simple as an incorrect password. What do the logs on the MongoDB side say?

metadaddy gravatar imagemetadaddy ( 2018-06-06 11:40:47 -0500 )edit

Hi metadaddy! Thanks! I double checked the password and using the MongoDB Compass Client, i can connect with those same credentials. Also, the exception seems to indicate some sort of missing class definition: "Caused by: PBKDF2WithHmacSHA1 SecretKeyFactory"

medmehdi gravatar imagemedmehdi ( 2018-06-06 12:41:15 -0500 )edit

Ah yes - I see that now. What JVM are you using? PBKDF2WithHmacSHA1 is in the Oracle JVMs, but it sounds like it's not available in yours.

metadaddy gravatar imagemetadaddy ( 2018-06-06 12:51:25 -0500 )edit

I'm using JDK 1.8 (official JDK from Oracle). I know, that's why I was puzzled, the algorithm is usually well known and exists by default. The exception hints that SecretKeyFactory class is either ill-defined in my installation or it does not have the algorithm. Is there a way to enrich jars is SDC?

medmehdi gravatar imagemedmehdi ( 2018-06-07 05:05:05 -0500 )edit