NutzCN Logo
问答 ioc 初始化异常 找不到ioc
发布于 2351天前 作者 daydayup 2147 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk

at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:152)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:271)
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:202)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.nutz.mvc.WhaleFilter.doFilter(WhaleFilter.java:171)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634)
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:215)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:531)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:760)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:678)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: IocBean[apiTestSignController] fail at field=[memberService]
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:40)
at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:67)
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:138)
... 40 more
Caused by: org.nutz.ioc.IocException: IocBean[class:cn.wizzer.app.member.modules.services.MemberService] none ioc bean match class=cn.wizzer.app.member.modules.services.MemberService
at org.nutz.ioc.impl.NutIoc.getByType(NutIoc.java:461)
at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:66)
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
... 42 more

以上是 异常
我新建的一个模块 ,写了一个服务接口 memberService 注解也写了 可是还是报这个错

12 回复
@IocBean(args = {"refer:dao"})
@Service(interfaceClass=MemberService.class)
public class MemberServiceImpl extends BaseServiceImpl<Member> implements MemberService {
    public MemberServiceImpl(Dao dao) {
        super(dao);
    }

    @Inject
    private RedisService redisService;


    @Override
    public void Test() {
        redisService.set("test","test");
        String test = redisService.get("test");
        System.out.println(test);
    }
}

这样写为什么会找不到呢

Caused by: java.lang.RuntimeException: IocBean[apiTestSignController] fail at field=[memberService]
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:40)
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:67)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:138)
	... 40 more
Caused by: org.nutz.ioc.IocException: IocBean[class:cn.wizzer.app.member.modules.services.MemberService] none ioc bean match class=cn.wizzer.app.member.modules.services.MemberService
	at org.nutz.ioc.impl.NutIoc.getByType(NutIoc.java:461)
	at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:66)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
	... 42 more

mvn clean install
根目录执行重新编译

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project wk-nb-service-cms: Compilation failure: Compilation failure:
[ERROR] /Users/haigo/Downloads/rich_paper/NutzWk-nutzboot-dubbo/wk-app/wk-nb-service-cms/src/main/java/cn/wizzer/app/cms/modules/services/impl/CmsTestServiceImpl.java:[3,40] 找不到符号
[ERROR] 符号:   类 Cms_test
[ERROR] 位置: 程序包 cn.wizzer.app.cms.modules.models
[ERROR] /Users/haigo/Downloads/rich_paper/NutzWk-nutzboot-dubbo/wk-app/wk-nb-service-cms/src/main/java/cn/wizzer/app/cms/modules/services/impl/CmsTestServiceImpl.java:[4,42] 找不到符号
[ERROR] 符号:   类 CmsTestService
[ERROR] 位置: 程序包 cn.wizzer.app.cms.modules.services
[ERROR] /Users/haigo/Downloads/rich_paper/NutzWk-nutzboot-dubbo/wk-app/wk-nb-service-cms/src/main/java/cn/wizzer/app/cms/modules/services/impl/CmsTestServiceImpl.java:[17,57] 找不到符号
[ERROR] 符号: 类 Cms_test
[ERROR] /Users/haigo/Downloads/rich_paper/NutzWk-nutzboot-dubbo/wk-app/wk-nb-service-cms/src/main/java/cn/wizzer/app/cms/modules/services/impl/CmsTestServiceImpl.java:[17,78] 找不到符号
[ERROR] 符号: 类 CmsTestService
[ERROR] /Users/haigo/Downloads/rich_paper/NutzWk-nutzboot-dubbo/wk-app/wk-nb-service-cms/src/main/java/cn/wizzer/app/cms/modules/services/impl/CmsTestServiceImpl.java:[16,27] 找不到符号
[ERROR] 符号: 类 CmsTestService
[ERROR] /Users/haigo/Downloads/rich_paper/NutzWk-nutzboot-dubbo/wk-app/wk-nb-service-cms/src/main/java/cn/wizzer/app/cms/modules/services/impl/CmsTestServiceImpl.java:[26,5] 方法不会覆盖或实现超类型的方法
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project wk-nb-service-member: Compilation failure: Compilation failure: 
[ERROR] /Users/haigo/Downloads/rich_paper/NutzWk-nutzboot-dubbo/wk-app/wk-nb-service-member/src/main/java/cn/wizzer/app/member/modules/services/impl/MemberServiceImpl.java:[3,43] 程序包cn.wizzer.app.member.modules.models不存在
[ERROR] /Users/haigo/Downloads/rich_paper/NutzWk-nutzboot-dubbo/wk-app/wk-nb-service-member/src/main/java/cn/wizzer/app/member/modules/services/impl/MemberServiceImpl.java:[4,45] 找不到符号
[ERROR]   符号:   类 MemberService
[ERROR]   位置: 程序包 cn.wizzer.app.member.modules.services
[ERROR] /Users/haigo/Downloads/rich_paper/NutzWk-nutzboot-dubbo/wk-app/wk-nb-service-member/src/main/java/cn/wizzer/app/member/modules/services/impl/MemberServiceImpl.java:[18,56] 找不到符号
[ERROR]   符号: 类 Member
[ERROR] /Users/haigo/Downloads/rich_paper/NutzWk-nutzboot-dubbo/wk-app/wk-nb-service-member/src/main/java/cn/wizzer/app/member/modules/services/impl/MemberServiceImpl.java:[18,75] 找不到符号
[ERROR]   符号: 类 MemberService
[ERROR] /Users/haigo/Downloads/rich_paper/NutzWk-nutzboot-dubbo/wk-app/wk-nb-service-member/src/main/java/cn/wizzer/app/member/modules/services/impl/MemberServiceImpl.java:[17,25] 找不到符号
[ERROR]   符号: 类 MemberService
[ERROR] /Users/haigo/Downloads/rich_paper/NutzWk-nutzboot-dubbo/wk-app/wk-nb-service-member/src/main/java/cn/wizzer/app/member/modules/services/impl/MemberServiceImpl.java:[27,5] 方法不会覆盖或实现超类型的方法
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

执行命令的时候出现的错误
这个是怎么回事呀

注入MemberService的地方没写@Referener ?

编译错误还需要解释?

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