NutzCN Logo
问答 使用 ServletContextListener 里面的dao都是null,使用mvc.getIoc().get()也不行
发布于 125天前 作者 qq_ddb9f080 84 次浏览 复制 上一个帖子 下一个帖子
标签:

使用 ServletContextListener 里面的dao都是null,使用mvc.getIoc().get()也不行

8 回复

Caused by: org.nutz.ioc.ObjectLoadException: Object 'userDao' without define!

七月 17, 2017 1:57:42 下午 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class [com.h3c.uism.core.session.SessionContextListener]
org.nutz.ioc.IocException: IocBean[userDao] For object [userDao] - type:[class com.h3c.uism.user.dao.UserDao]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:218)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:239)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:146)
at com.h3c.uism.core.session.SessionContextListener.contextInitialized(SessionContextListener.java:35)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.nutz.ioc.ObjectLoadException: Object 'userDao' without define!
at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:166)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:180)
... 12 more

就木有UserDao这个bean

另外,contextInitialized是比Filter先初始化的,nutz还没启动,哪来ioc

用@SetupBy不好吗?何必写listener

恩 就用@SetupBy 好用些 谢谢

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