NutzCN Logo
问答 运行程序的时候报这个错 求救
发布于 2785天前 作者 kamier 2182 次浏览 复制 上一个帖子 下一个帖子
标签:

17-3-31 17:30:14.388 DEBUG [http-bio-8080-exec-6] Found mapping for [POST] path=/user/login : UserModule.login(UserModule.java:27)
17-3-31 17:30:14.388 DEBUG [http-bio-8080-exec-6] Get 'userModule'<class com.demo.module.UserModule>
17-3-31 17:30:14.388 DEBUG [http-bio-8080-exec-6] >> Load definition name=userModule
17-3-31 17:30:14.388 DEBUG [http-bio-8080-exec-6] Loading define for name=userModule
17-3-31 17:30:14.389 DEBUG [http-bio-8080-exec-6] Found IocObject(userModule) in JsonLoader(paths=[config/])
17-3-31 17:30:14.389 DEBUG [http-bio-8080-exec-6] >> Make...'userModule'<class com.demo.module.UserModule>
17-3-31 17:30:14.390 DEBUG [http-bio-8080-exec-6] Load class com.demo.module.UserModule without AOP
17-3-31 17:30:14.390 DEBUG [http-bio-8080-exec-6] Save object 'userModule' to [app]
17-3-31 17:30:14.390 DEBUG [http-bio-8080-exec-6] Remove object 'userModule' from [app]
17-3-31 17:30:14.391 WARN [http-bio-8080-exec-6] Error@/user/login :
org.nutz.ioc.IocException: [userModule] # FAIL to create Ioc Bean name=[userModule]
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:149)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:210)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:239)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:116)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.RuntimeException: Fail to eval Injector for field: 'userService'
at org.nutz.lang.Lang.wrapThrow(Lang.java:165)
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:128)
... 27 more
Caused by: java.lang.RuntimeException: java.lang.NoSuchFieldException: Can NOT find field [userService] in class [com.demo.module.UserModule] and it's parents classes
at org.nutz.lang.Lang.wrapThrow(Lang.java:182)
at org.nutz.lang.Mirror.getInjecting(Mirror.java:1048)
at org.nutz.ioc.weaver.FieldInjector.create(FieldInjector.java:18)
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:125)
... 27 more
Caused by: java.lang.NoSuchFieldException: Can NOT find field [userService] in class [com.demo.module.UserModule] and it's parents classes
at org.nutz.lang.Mirror.getField(Mirror.java:476)
at org.nutz.lang.Mirror.getInjecting(Mirror.java:1039)
... 29 more

9 回复
var handler = {
		userModule : {
			type : "com.demo.module.UserModule",
			fields : {
				userService : { refer : "userService" }
			}
		},
		menuModule : {
			type : "com.demo.module.MenuModule",
			fields : {
				menuService : { refer : "menuService" }
			}
		}

}
var service = {
		userService : {
			type : "com.demo.service.UserService",
			fields : {
				dao : { refer : "dao" }
			}
		},
		menuService : {
			type : "com.demo.service.MenuService",
			fields : {
				dao : { refer : "dao" }
			}
		}

}

UserModule缺个userService 属性

PS: 为啥不用注解呢

var handler = {
userModule : {
type : "com.demo.module.UserModule",
fields : {
userService : { refer : "userService" }
}
},
menuModule : {
type : "com.demo.module.MenuModule",
fields : {
menuService : { refer : "menuService" }
}
}

}
var service = {
userService : {
type : "com.demo.service.UserService",
fields : {
dao : { refer : "dao" }
}
},
menuService : {
type : "com.demo.service.MenuService",
fields : {
dao : { refer : "dao" }
}
}

}

我是这样写的 为什么错了 还有 哪里缺个userService呢 我现在还不会注解配置....

说的是UserModule这个类缺了个userService 属性,

你在js里面声明了UserModule带个userService 属性,但事实上没有

贴UserModule这个类.

是java类缺属性,不是js

不会用注解? 先看一遍nutzbook

@wendal 嗯,注解大法 好,灵活运用反射机制,简化代码,提高可读性。

来自炫酷的 NutzCN

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