2 shuijingliu shuijingliu 于 2015.07.24 13:45 提问

com.mongodb.MongoException

Exception in thread "main" org.springframework.data.mongodb.CannotGetMongoDbConnectionException: Failed to authenticate to database [products], username = [worker], password = [a*******6]
at org.springframework.data.mongodb.core.ReflectiveDbInvoker.authenticate(ReflectiveDbInvoker.java:83)
at org.springframework.data.mongodb.core.MongoDbUtils.doGetDB(MongoDbUtils.java:127)
at org.springframework.data.mongodb.core.MongoDbUtils.getDB(MongoDbUtils.java:94)
at org.springframework.data.mongodb.core.SimpleMongoDbFactory.getDb(SimpleMongoDbFactory.java:197)
at org.springframework.data.mongodb.core.SimpleMongoDbFactory.getDb(SimpleMongoDbFactory.java:185)
at org.springframework.data.mongodb.core.MongoTemplate.getDb(MongoTemplate.java:1595)
at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:441)
at org.springframework.data.mongodb.core.MongoTemplate.doCreateCollection(MongoTemplate.java:1612)
at org.springframework.data.mongodb.core.MongoTemplate.createCollection(MongoTemplate.java:492)
at com.qixin.appmarket.service.test.TestMongodb.main(TestMongodb.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

5个回答

enson16855
enson16855   2015.07.24 13:47

用户名和密码不正确 验证失败了

enson16855
enson16855 回复shuijingliu: 用户worker对products有权限么?
2 年多之前 回复
shuijingliu
shuijingliu 检查了用户名和密码是正确的
2 年多之前 回复
oyljerry
oyljerry   Ds   Rxr 2015.07.24 13:51
 Exception in thread "main" org.springframework.data.mongodb.CannotGetMongoDbConnectionException: Failed to authenticate to database [products], username = [worker], password = [a*******6]

你的数据库,用户名,密码不正确吧。

shuijingliu
shuijingliu 检查了用户名和密码是正确的
2 年多之前 回复
taomanman
taomanman   Rxr 2015.07.24 14:09

Failed to authenticate to database [products], username = [worker], password = [a*******6]

错误提示说“你用户名worker,密码a.....6的账户没有访问products数据库的权限”,检查你的授权试试

CSDNXIAOD
CSDNXIAOD   2015.07.24 15:58

mongodb
----------------------biu~biu~biu~~~在下问答机器人小D,这是我依靠自己的聪明才智给出的答案,如果不正确,你来咬我啊!

wojiushiwo945you
wojiushiwo945you   Ds   Rxr 2015.11.18 13:40

异常信息显示数据库products授权问题,你的访问用户没有操作products数据库的权限呢。

Csdn user default icon
上传中...
上传图片
插入图片