NutzCN Logo
问答 nutz框架上mongodb用密码验证登录会报错!!!
发布于 2709天前 作者 一叶孤舟 1583 次浏览 复制 上一个帖子 下一个帖子
标签:

一样的nutz框架集成mongodb的程序,在别人电脑上eclipse上运行能正常插入数据,而放到我的电脑上,就报这个错误。如果mongdb在启动时auth不是true的话,是可以正常插入的,这是为什么呢。

运行错误:
2016-12-2 16:35:25 com.mongodb.diagnostics.logging.JULLogger log
信息: No server chosen by ReadPreferenceServerSelector{readPreference=primary} from cluster description ClusterDescription{type=UNKNOWN, connectionMode=MULTIPLE, all=[ServerDescription{address=10.144.100.215:27017, type=UNKNOWN, state=CONNECTING}]}. Waiting for 30000 ms before timing out
2016-12-2 16:35:25 com.mongodb.diagnostics.logging.JULLogger log
信息: Exception in monitor thread while connecting to server 10.144.100.215:27017
com.mongodb.MongoSecurityException: Exception authenticating
at com.mongodb.connection.NativeAuthenticator.authenticate(NativeAuthenticator.java:48)
at com.mongodb.connection.InternalStreamConnectionInitializer.authenticateAll(InternalStreamConnectionInitializer.java:99)
at com.mongodb.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:44)
at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:115)
at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:128)
at java.lang.Thread.run(Thread.java:662)
Caused by: com.mongodb.MongoCommandException: Command failed with error 18: 'auth failed' on server 10.144.100.215:27017. The full response is { "ok" : 0.0, "errmsg" : "auth failed", "code" : 18 }
at com.mongodb.connection.CommandHelper.createCommandFailureException(CommandHelper.java:170)
at com.mongodb.connection.CommandHelper.receiveCommandResult(CommandHelper.java:123)
at com.mongodb.connection.CommandHelper.executeCommand(CommandHelper.java:32)
at com.mongodb.connection.NativeAuthenticator.authenticate(NativeAuthenticator.java:46)
... 5 more


db.js配置如下: zMongo : { args : [ "perfdba1","hope123","10.144.100.101",27017,"nwimscmdb" ], // 或者不写参数,默认就是127.0.0.1和27017 //args : ["10.144.100.215", 27017], factory : "org.nutz.mongo.ZMongo#me" }, zMoDB : { args : [ "nwimscmdb" ], // 数据库名称 factory : "$zMongo#db" }, zMoCo : { args : [ "tomcat" ], factory : "$zMoDB#c" }
3 回复

mongodb的版本不一样吧? 换新版mongodb, 然后改成 nutzmongo 1.r.59

都是连一样的数据库,nutzmogo也是1.r.59,程序都是一样的,好奇特。

@qq_16673030 你可以看看nutzmongo最近那几个修改,跟数据库端的设置有关

添加回复
请先登陆
回到顶部