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(SaslAuthenticator.java:162)
    at com.mongodb.connection.SaslAuthenticator.access$200(SaslAuthenticator.java:39)
    at com.mongodb.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:68)
    at com.mongodb.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:46)
    at com.mongodb.connection.SaslAuthenticator.doAsSubject(SaslAuthenticator.java:168)
    at com.mongodb.connection.SaslAuthenticator.authenticate(SaslAuthenticator.java:46)
    at com.mongodb.connection.DefaultAuthenticator.authenticate(DefaultAuthenticator.java:32)
    at com.mongodb.connection.InternalStreamConnectionInitializer.authenticateAll(InternalStreamConnectionInitializer.java:109)
    at com.mongodb.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:46)
    at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:108)
    at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:111)
    at java.lang.Thread.run(Thread.java:748)
Caused by: javax.security.sasl.SaslException: Unable to find PBKDF2WithHmacSHA1. [Caused by java.security.NoSuchAlgorithmException: PBKDF2WithHmacSHA1 SecretKeyFactory not available]
    at com.mongodb.connection.ScramSha1Authenticator$ScramSha1SaslClient.hi(ScramSha1Authenticator.java:229)
    at com.mongodb.connection.ScramSha1Authenticator$ScramSha1SaslClient.computeClientFinalMessage(ScramSha1Authenticator.java:166)
    at com.mongodb.connection.ScramSha1Authenticator$ScramSha1SaslClient.evaluateChallenge(ScramSha1Authenticator.java:99)
    at com.mongodb.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:57)
    ... 9 more
Caused by: java.security.NoSuchAlgorithmException: PBKDF2WithHmacSHA1 SecretKeyFactory not available
    at javax.crypto.SecretKeyFactory.<init>(SecretKeyFactory.java:122)
    at javax.crypto.SecretKeyFactory.getInstance(SecretKeyFactory.java:160)
    at com.mongodb.connection.ScramSha1Authenticator$ScramSha1SaslClient.hi(ScramSha1Authenticator.java:226)
    ... 12 more

Any idea how I can quickly remedy the situation?

Thank you very much!

edit retag flag offensive close merge delete

Comments

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: java.security.NoSuchAlgorithmException: 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