Проверка подлинности MongoDB завершилась неудачно в SPRINGBOOT, но что-то хорошо работает в монго SHELL, ПОЧЕМУ? - PullRequest
0 голосов
/ 24 апреля 2019

Описание : Я не могу пройти проверку авторизации MongoDB в Springboot, но могу пройти в среде оболочки mongo.

  1. Я подтверждаю, что парольисправить в SpringBoot
  2. Хорошо работает в Robo 3T клиенте

Справка :

Я игнорировал какие-либодругие операции?

Окружение: оболочка монго

[dev@local ~]$ mongo 127.0.0.1:27017/wm-mongo -u wm-mongo -p SOh3TbYhx8ypJPxmt1oOfL
MongoDB shell version v3.4.20
connecting to: mongodb://127.0.0.1:27017/wm-mongo
MongoDB server version: 3.4.20
> show collections
ShuJuMoHeMessage
ShuJuMoHeReport
system.users
> db.ShuJuMoHeReport.find()
> db.ShuJuMoHeReport.count()
0
> 

Окружение: пружинный башмак

spring.data.mongodb.uri = mongodb: // wm-mongo: SOh3TbYhx8ypJPxmt1oOfL@127.0.0.1: 27017 / wm-mongo

Caused by: com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='wm-mongo', source='wm-mongo', password=<hidden>, mechanismProperties={}}
        at com.mongodb.internal.connection.SaslAuthenticator.wrapException(SaslAuthenticator.java:173)
        at com.mongodb.internal.connection.SaslAuthenticator.access$300(SaslAuthenticator.java:40)
        at com.mongodb.internal.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:70)
        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:151)
        at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:64)
        at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:127)
        at com.mongodb.internal.connection.UsageTrackingInternalConnection.open(UsageTrackingInternalConnection.java:50)
        at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.open(DefaultConnectionPool.java:390)
        at com.mongodb.internal.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:106)
        at com.mongodb.internal.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:92)
        at com.mongodb.internal.connection.DefaultServer.getConnection(DefaultServer.java:85)
        at com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.getConnection(ClusterBinding.java:114)
        at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:451)
        at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:415)
        at com.mongodb.operation.CreateIndexesOperation.execute(CreateIndexesOperation.java:169)
        at com.mongodb.operation.CreateIndexesOperation.execute(CreateIndexesOperation.java:70)
        at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:193)
        at com.mongodb.client.internal.MongoCollectionImpl.executeCreateIndexes(MongoCollectionImpl.java:805)
        at com.mongodb.client.internal.MongoCollectionImpl.createIndexes(MongoCollectionImpl.java:788)
        at com.mongodb.client.internal.MongoCollectionImpl.createIndexes(MongoCollectionImpl.java:783)
        at com.mongodb.client.internal.MongoCollectionImpl.createIndex(MongoCollectionImpl.java:768)
        at org.springframework.data.mongodb.core.DefaultIndexOperations.lambda$ensureIndex$0(DefaultIndexOperations.java:135)
        at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:535)
        ... 83 common frames omitted
Caused by: com.mongodb.MongoCommandException: Command failed with error 18 (AuthenticationFailed): 'Authentication failed.' on server 127.0.0.1:27017. The full response is { "ok" : 0.0, "errmsg" : "Authentication failed.", "code" : 18, "codeName" : "AuthenticationFailed" }
        at com.mongodb.internal.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:179)
        at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:293)
        at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:255)
        at com.mongodb.internal.connection.CommandHelper.sendAndReceive(CommandHelper.java:83)
        at com.mongodb.internal.connection.CommandHelper.executeCommand(CommandHelper.java:33)
        at com.mongodb.internal.connection.SaslAuthenticator.sendSaslContinue(SaslAuthenticator.java:134)
        at com.mongodb.internal.connection.SaslAuthenticator.access$200(SaslAuthenticator.java:40)
        at com.mongodb.internal.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:67)
        ... 106 common frames omitted
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...