Answer the question
In order to leave comments, you need to log in
Spring Boot - MongoDb Authentication failed (error 18) but from intellij - works?
Hello,
I searched on the Internet, but I did not find a solution, can anyone come across?
There is MongDb running from docker (off distribution kit), from the intellij plugin (Mongo Explorer) - I authenticate, I see the data on the server.
Now I'm trying to get a connection from spring-boot - respectively in application.properties
spring.data.mongodb.uri=mongodb://jdev:[email protected]:37017/cam?authMechanism=SCRAM-SHA-1
compile 'org.springframework.boot:spring-boot-starter-data-mongodb:1.5.1.RELEASE'
compile 'org.mongodb:mongo-java-driver:3.4.2'
2017-02-10 18:03:44.889 INFO 5388 --- [ restartedMain] org.mongodb.driver.cluster : Cluster created with settings {hosts=[ip:37017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
2017-02-10 18:03:45.230 INFO 5388 --- [ip:37017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server ip:37017
com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='jdev', source='cam', password=<hidden>, mechanismProperties={}}
at com.mongodb.connection.SaslAuthenticator.wrapInMongoSecurityException(SaslAuthenticator.java:157) ~[mongodb-driver-core-3.4.1.jar:na]
at com.mongodb.connection.SaslAuthenticator.access$200(SaslAuthenticator.java:37) ~[mongodb-driver-core-3.4.1.jar:na]
at com.mongodb.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:66) ~[mongodb-driver-core-3.4.1.jar:na]
at com.mongodb.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:44) ~[mongodb-driver-core-3.4.1.jar:na]
at com.mongodb.connection.SaslAuthenticator.doAsSubject(SaslAuthenticator.java:162) ~[mongodb-driver-core-3.4.1.jar:na]
at com.mongodb.connection.SaslAuthenticator.authenticate(SaslAuthenticator.java:44) ~[mongodb-driver-core-3.4.1.jar:na]
at com.mongodb.connection.InternalStreamConnectionInitializer.authenticateAll(InternalStreamConnectionInitializer.java:109) ~[mongodb-driver-core-3.4.1.jar:na]
at com.mongodb.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:46) ~[mongodb-driver-core-3.4.1.jar:na]
at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:116) ~[mongodb-driver-core-3.4.1.jar:na]
at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:113) ~[mongodb-driver-core-3.4.1.jar:na]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_74]
Caused by: com.mongodb.MongoCommandException: Command failed with error 18: 'Authentication failed.' on server ip:37017. The full response is { "ok" : 0.0, "errmsg" : "Authentication failed.", "code" : 18, "codeName" : "AuthenticationFailed" }
at com.mongodb.connection.CommandHelper.createCommandFailureException(CommandHelper.java:170) ~[mongodb-driver-core-3.4.1.jar:na]
at com.mongodb.connection.CommandHelper.receiveCommandResult(CommandHelper.java:123) ~[mongodb-driver-core-3.4.1.jar:na]
at com.mongodb.connection.CommandHelper.executeCommand(CommandHelper.java:32) ~[mongodb-driver-core-3.4.1.jar:na]
at com.mongodb.connection.SaslAuthenticator.sendSaslStart(SaslAuthenticator.java:117) ~[mongodb-driver-core-3.4.1.jar:na]
at com.mongodb.connection.SaslAuthenticator.access$000(SaslAuthenticator.java:37) ~[mongodb-driver-core-3.4.1.jar:na]
at com.mongodb.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:50) ~[mongodb-driver-core-3.4.1.jar:na]
... 8 common frames omitted
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question