NutzCN Logo
问答 自己定义的service怎么会注入不成功呢?
发布于 2912天前 作者 shusheng 1806 次浏览 复制 上一个帖子 下一个帖子
标签:

定义service

@IocBean(create="init")
public class ForumService {

其他类中

@Inject
protected ForumService forumService;

报错了

08:59:26.813 WARN  (FailProcessor.java:28) process - Error@/forum/list :
org.nutz.ioc.IocException: [forumModule, forumService] # FAIL to create Ioc Bean name=[forumService]
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:149) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:210) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:26) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:31) ~[nutz-1.r.59-SNAPSHOT.jar:?]
3 回复

完整报错信息

@wendal

org.nutz.ioc.IocException: [forumModule, forumService] # FAIL to create Ioc Bean name=[forumService]
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:149) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:210) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:26) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:31) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:135) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:210) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:239) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:116) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at net.wendal.nutzbook.mvc.DailyUniqueUsersProcessor.process(DailyUniqueUsersProcessor.java:48) ~[classes/:?]
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at net.wendal.nutzbook.mvc.LogTimeProcessor.process(LogTimeProcessor.java:19) ~[classes/:?]
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44) [nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:68) [nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31) [nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198) [nutz-1.r.59-SNAPSHOT.jar:?]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [catalina.jar:9.0.0.M11]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [catalina.jar:9.0.0.M11]
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) [druid-1.0.25.jar:1.0.25]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [catalina.jar:9.0.0.M11]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [catalina.jar:9.0.0.M11]
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) [shiro-web-1.3.2.jar:1.3.2]
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) [shiro-web-1.3.2.jar:1.3.2]
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) [shiro-core-1.3.2.jar:1.3.2]
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) [shiro-core-1.3.2.jar:1.3.2]
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) [shiro-core-1.3.2.jar:1.3.2]
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) [shiro-web-1.3.2.jar:1.3.2]
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.3.2.jar:1.3.2]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [catalina.jar:9.0.0.M11]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [catalina.jar:9.0.0.M11]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) [catalina.jar:9.0.0.M11]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108) [catalina.jar:9.0.0.M11]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) [catalina.jar:9.0.0.M11]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [catalina.jar:9.0.0.M11]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [catalina.jar:9.0.0.M11]
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620) [catalina.jar:9.0.0.M11]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [catalina.jar:9.0.0.M11]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) [catalina.jar:9.0.0.M11]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784) [tomcat-coyote.jar:9.0.0.M11]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-coyote.jar:9.0.0.M11]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802) [tomcat-coyote.jar:9.0.0.M11]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455) [tomcat-coyote.jar:9.0.0.M11]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:9.0.0.M11]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_102]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_102]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:9.0.0.M11]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_102]
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: Fail to find Method net.wendal.nutzbook.service.forum.ForumService$$NUTZAOP->init with params:
[]
	at org.nutz.lang.Lang.wrapThrow(Lang.java:182) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.ioc.impl.ObjectMakerImpl.createTrigger(ObjectMakerImpl.java:174) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:62) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	... 51 more
Caused by: java.lang.NoSuchMethodException: Fail to find Method net.wendal.nutzbook.service.forum.ForumService$$NUTZAOP->init with params:
[]
	at org.nutz.lang.Mirror.findMethod(Mirror.java:1162) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.ioc.impl.ObjectMakerImpl.createTrigger(ObjectMakerImpl.java:171) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:62) ~[nutz-1.r.59-SNAPSHOT.jar:?]
	... 51 more

ForumService缺了个无参数的init方法

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