NutzCN Logo
问答 Object 'dao' without define!
发布于 2762天前 作者 qq_d6d46f6d 2506 次浏览 复制 上一个帖子 下一个帖子
标签:

嵌入微信相关的内容,为了实现相关逻辑,参照Wx,自定义了WxHandler。
该handler内部注入WxconfigService.
注入此service时,报dao Without define。
日志如下

2017-05-31 10:26:56,877 org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) WARN  - Error@/ :
org.nutz.ioc.IocException: IocBean[mainModule] throw Exception when creating
	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:202)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: IocBean[mainModule] fail at field=[handler]
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:40)
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:135)
	... 29 more
Caused by: org.nutz.ioc.IocException: IocBean[handler] throw Exception when creating
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:149)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:210)
	at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:60)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
	... 31 more
Caused by: java.lang.RuntimeException: IocBean[handler] fail at field=[wxConfigService1]
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:40)
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:135)
	... 34 more
Caused by: org.nutz.ioc.IocException: IocBean[wxConfigService -> dao] For object [dao] - type:[]
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:218)
	at org.nutz.ioc.val.ReferValue.get(ReferValue.java:24)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:75)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:210)
	at org.nutz.ioc.impl.NutIoc.getByType(NutIoc.java:395)
	at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:66)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
	... 36 more
Caused by: org.nutz.ioc.ObjectLoadException: Object 'dao' without define!
	at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:166)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:180)
	... 42 more

handler 部分如下

@IocBean(name = "handler")
public class WxHandler extends AbstractWxHandler {
    private final static Log log = Logs.get();
    protected String token;
    protected String aeskey;
    protected WXBizMsgCrypt msgCrypt;
    protected String appid;
    protected WxApi2 api;

    @Inject
    private WxConfigService wxConfigService1;

在此之前,已经扫描到 WxConfigService
说明该Service本身应该没有问题
iocBy也是按照统一的包名再扫描

2017-05-31 10:26:56,876 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'wxConfigService'<class com.timemans.services.wx.WxConfigService>
2017-05-31 10:26:56,876 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - 	 >> Load definition name=wxConfigService
2017-05-31 10:26:56,876 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:161) DEBUG - Found IocObject(wxConfigService) in AnnotationIocLoader(packages=[com.timemans])
2017-05-31 10:26:56,876 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209) DEBUG - 	 >> Make...'wxConfigService'<class com.timemans.services.wx.WxConfigService>
2017-05-31 10:26:56,876 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'txREAD_COMMITTED'<interface org.nutz.aop.MethodInterceptor>
2017-05-31 10:26:56,876 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'txREAD_COMMITTED'<interface org.nutz.aop.MethodInterceptor>
2017-05-31 10:26:56,876 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'wxConfigService' to [app] 
6 回复

说错了参照的是Wk

报的是找不到dao!!

WxConfigService 依赖了dao,但没定义它

哎,找到原因了。
dao.json因为经常调试都不上传的,结果down下来也没看有没有这文件,这给我折腾的,太2了。

Object 'upload' without define!,,这种在哪儿定义?

通常是upload.js

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