Задать вопрос
web_dev
@web_dev

Spring Boot — MongoDb Ошибка аутентификации (error 18), но из intellij — работает?

Здравствуйте,

поискал в интернете, но решения так и не нашел, может кто сталкивался?
Есть MongDb запущенная из docker(офф дистрибутив), из intellij плагина(Mongo Explorer) - аутентифицируюсь, вижу данные на сервере.

Теперь пытаюсь получить коннект из spring-boot - соответственно в application.properties
spring.data.mongodb.uri=mongodb://jdev:pass@ip: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


Благодарен за подсказки.
  • Вопрос задан
  • 913 просмотров
Подписаться 1 Оценить Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы