NutzCN Logo
问答 Nutzboot mongodb 使用用户名密码无法注入(链接不上)
发布于 2253天前 作者 Java 1366 次浏览 复制 上一个帖子 下一个帖子
标签:

SpringBoot 没有问题 不配置用户密码nutzboot也连的上,可以正常注入
application.propertiesmongo配置如下(密码无任何特殊字符,只有数字,字母):

mongo.ip=xxx
mongo.port=9529
mongo.dbname=muniu
mongo.username=muniu
mongo.password=xxxx

错误日志如下:
00:39:02.243 DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(zmodb) in AnnotationIocLoader(packages=[org.nutz.boot.starter])
00:39:02.243 DEBUG org.nutz.ioc.impl.NutIoc - Get 'zmodb'<class org.nutz.mongo.ZMoDB>
00:39:02.243 DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=zmodb
00:39:02.243 DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(zmodb) in AnnotationIocLoader(packages=[org.nutz.boot.starter])
00:39:02.243 DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'zmodb'<class org.nutz.mongo.ZMoDB>
00:39:02.243 DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'zmodb' to [app]
00:39:02.243 DEBUG org.nutz.ioc.impl.NutIoc - Get 'zmongo'<class org.nutz.mongo.ZMongo>
00:39:02.243 DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=zmongo
00:39:02.243 DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(zmongo) in AnnotationIocLoader(packages=[org.nutz.boot.starter])
00:39:02.243 DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'zmongo'<class org.nutz.mongo.ZMongo>
00:39:02.243 DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'zmongo' to [app]
00:39:02.250 DEBUG org.nutz.ioc.aop.impl.DefaultMirrorFactory - Load class org.nutz.mongo.ZMongo without AOP
00:39:02.250 DEBUG org.nutz.ioc.impl.NutIoc - Get 'nutMongoDbStarter'<>
00:39:02.253 DEBUG org.nutz.ioc.impl.NutIoc - Get 'mongoClient'<class com.mongodb.MongoClient>
00:39:02.253 DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=mongoClient
00:39:02.253 DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(mongoClient) in AnnotationIocLoader(packages=[org.nutz.boot.starter])
00:39:02.253 DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'mongoClient'<class com.mongodb.MongoClient>
00:39:02.253 DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'mongoClient' to [app]
00:39:02.266 DEBUG org.nutz.ioc.aop.impl.DefaultMirrorFactory - Load class com.mongodb.MongoClient without AOP
00:39:02.266 DEBUG org.nutz.ioc.impl.NutIoc - Get 'nutMongoDbStarter'<>
00:39:02.313 DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection org.mariadb.jdbc.MariaDbConnection@5585a197
00:39:02.326 DEBUG org.nutz.ioc.impl.NutIoc - Get 'mongodbServerAddressList'<interface java.util.List>
00:39:02.326 DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=mongodbServerAddressList
00:39:02.326 DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(mongodbServerAddressList) in AnnotationIocLoader(packages=[org.nutz.boot.starter])
00:39:02.326 DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'mongodbServerAddressList'<interface java.util.List>
00:39:02.326 DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'mongodbServerAddressList' to [app]
00:39:02.326 DEBUG org.nutz.ioc.impl.NutIoc - Get 'nutMongoDbStarter'<>
00:39:02.327 DEBUG org.nutz.ioc.impl.NutIoc - Get 'mongodbCredentialList'<interface java.util.List>
00:39:02.327 DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=mongodbCredentialList
00:39:02.327 DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(mongodbCredentialList) in AnnotationIocLoader(packages=[org.nutz.boot.starter])
00:39:02.327 DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'mongodbCredentialList'<interface java.util.List>
00:39:02.327 DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'mongodbCredentialList' to [app]
00:39:02.327 DEBUG org.nutz.ioc.impl.NutIoc - Get 'nutMongoDbStarter'<>
00:39:02.329 DEBUG org.nutz.ioc.impl.ScopeContext - Remove object 'mongodbCredentialList' from [app]
00:39:02.330 DEBUG org.nutz.ioc.impl.ScopeContext - Remove object 'mongoClient' from [app]
00:39:02.330 DEBUG org.nutz.ioc.impl.ScopeContext - Remove object 'zmongo' from [app]
00:39:02.330 DEBUG org.nutz.ioc.impl.ScopeContext - Remove object 'zmodb' from [app]
00:39:02.330 DEBUG org.nutz.ioc.impl.ScopeContext - Remove object 'mainLauncher' from [app]
00:39:02.330 ERROR org.nutz.boot.NbApp - something happen!!
org.nutz.ioc.IocException: IocBean[mainLauncher] throw Exception when creating
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:152) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:271) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:161) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.boot.NbApp.execute(NbApp.java:209) [nutzboot-core-2.3-20181019.150719-68.jar:2.3-SNAPSHOT]
at org.nutz.boot.NbApp.run(NbApp.java:178) [nutzboot-core-2.3-20181019.150719-68.jar:2.3-SNAPSHOT]
at com.quailai.taodingfinance.MainLauncher.main(MainLauncher.java:111) [classes/:?]
Caused by: java.lang.RuntimeException: IocBean[mainLauncher] fail at field=[moDB]
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:40) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:67) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:138) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
... 6 more
Caused by: org.nutz.ioc.IocException: IocBean[zmodb -> zmongo] throw Exception when creating
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:152) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:60) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:64) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.NutIoc.getByType(NutIoc.java:457) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:66) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:67) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:138) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
... 6 more
Caused by: org.nutz.lang.InvokingException: Fail to invoke [org.nutz.boot.starter.mongodb.NutMongoDbStarter].getZMongo() by args:

For the reason: source can not be null
at org.nutz.lang.Invoking.invoke(Invoking.java:195) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.lang.Mirror.invoke(Mirror.java:1132) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.ObjectMakerImpl$1.born(ObjectMakerImpl.java:80) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.weaver.DefaultWeaver.born(DefaultWeaver.java:78) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:117) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:60) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:64) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.NutIoc.getByType(NutIoc.java:457) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:66) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:67) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:138) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
... 6 more
Caused by: java.lang.IllegalArgumentException: source can not be null
at com.mongodb.assertions.Assertions.notNull(Assertions.java:37) ~[mongo-java-driver-3.5.0.jar:?]
at com.mongodb.MongoCredential.(MongoCredential.java:311) ~[mongo-java-driver-3.5.0.jar:?]
at com.mongodb.MongoCredential.createScramSha1Credential(MongoCredential.java:175) ~[mongo-java-driver-3.5.0.jar:?]
at org.nutz.boot.starter.mongodb.NutMongoDbStarter.getCredentialList(NutMongoDbStarter.java:177) ~[nutzboot-starter-mongodb-2.3-20181019.150733-66.jar:2.3-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_161]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_161]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_161]
at org.nutz.lang.Invoking$NullArgInvoker.invoke(Invoking.java:77) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.lang.Invoking.invoke(Invoking.java:192) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.lang.Mirror.invoke(Mirror.java:1132) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.ObjectMakerImpl$1.born(ObjectMakerImpl.java:80) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.weaver.DefaultWeaver.born(DefaultWeaver.java:78) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:117) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:271) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.boot.starter.mongodb.NutMongoDbStarter.createMongoClient(NutMongoDbStarter.java:192) ~[nutzboot-starter-mongodb-2.3-20181019.150733-66.jar:2.3-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_161]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_161]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_161]
at org.nutz.lang.Invoking$NullArgInvoker.invoke(Invoking.java:77) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.lang.Invoking.invoke(Invoking.java:192) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.lang.Mirror.invoke(Mirror.java:1132) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.ObjectMakerImpl$1.born(ObjectMakerImpl.java:80) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.weaver.DefaultWeaver.born(DefaultWeaver.java:78) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:117) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:271) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:161) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.boot.starter.mongodb.NutMongoDbStarter.getZMongo(NutMongoDbStarter.java:197) ~[nutzboot-starter-mongodb-2.3-20181019.150733-66.jar:2.3-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_161]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_161]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_161]
at org.nutz.lang.Invoking$NullArgInvoker.invoke(Invoking.java:77) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.lang.Invoking.invoke(Invoking.java:192) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.lang.Mirror.invoke(Mirror.java:1132) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.ObjectMakerImpl$1.born(ObjectMakerImpl.java:80) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.weaver.DefaultWeaver.born(DefaultWeaver.java:78) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:117) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:60) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:64) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.NutIoc.getByType(NutIoc.java:457) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:66) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:67) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:138) ~[nutz-1.r.67-20181018.125222-41.jar:1.r.67-SNAPSHOT]
... 6 more
00:39:02.345 DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - stopping Server@6ff37443{STARTED}[9.4.12.v20180830]

3 回复

我好像见过这个错误,得明天看了

来自炫酷的 NutzCN

好的 麻烦兽总了

看了下源码,需要配置mongo.source 配置下就好了

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