NutzCN Logo
问答 dao注入失败?@Inject
发布于 2212天前 作者 qq_4ad560c4 2146 次浏览 复制 上一个帖子 下一个帖子
标签:
package net.wendal.nutzbook.controller;


import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
import net.wendal.nutzbook.pojo.User;
import net.wendal.nutzbook.service.UserService;
import org.nutz.dao.Dao;
import org.nutz.dao.impl.NutDao;
import org.nutz.dao.impl.SimpleDataSource;
import org.nutz.ioc.Ioc;
import org.nutz.ioc.impl.NutIoc;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.ioc.loader.json.JsonLoader;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;

import javax.sql.DataSource;
import java.sql.*;
import java.util.Date;
import java.util.List;

@IocBean
public class UserModule {

    @Inject
    private UserService userService;
    @Inject
    protected Dao dao;

    @At("/selectAll")
    @Ok("json")
    public List<User> selectAll() throws ClassNotFoundException, SQLException {
        System.out.println(null==userService);
        return userService.selectAll();
    }

    @At("/selectById/?")
    @Ok("json")
    public Object selectById(int id){
        System.out.println(id+"     ***************************************");
        return dao.count(User.class);
//        return new Date();
//        return userService.selectById(id);
    }

}

18-10-26 14:37:46.981 DEBUG [http-apr-8080-exec-10] Found mapping for [GET] path=/selectById/2 : UserModule.selectById(UserModule.java:41)
18-10-26 14:37:46.981 DEBUG [http-apr-8080-exec-10] Get 'userModule'<class net.wendal.nutzbook.controller.UserModule>
18-10-26 14:37:46.982 DEBUG [http-apr-8080-exec-10] 	 >> Load definition name=userModule
18-10-26 14:37:46.982 DEBUG [http-apr-8080-exec-10] 	 >> Make...'userModule'<class net.wendal.nutzbook.controller.UserModule>
18-10-26 14:37:46.982 DEBUG [http-apr-8080-exec-10] Save object 'userModule' to [app] 
18-10-26 14:37:46.982 DEBUG [http-apr-8080-exec-10] Load class net.wendal.nutzbook.controller.UserModule without AOP
18-10-26 14:37:46.983 DEBUG [http-apr-8080-exec-10] Get 'userService'<class net.wendal.nutzbook.service.UserService>
18-10-26 14:37:46.983 DEBUG [http-apr-8080-exec-10] name=dao not found, search for type=org.nutz.dao.Dao
18-10-26 14:37:46.983 DEBUG [http-apr-8080-exec-10] Remove object 'userModule' from [app] 
18-10-26 14:37:46.984 WARN [http-apr-8080-exec-10] Error@/selectById/2 :
org.nutz.ioc.IocException: IocBean[userModule] throw Exception when creating
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:152)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:231)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:260)
	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:94)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1152)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2527)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2516)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: IocBean[userModule] fail at field=[dao]
	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)
	... 29 more
Caused by: org.nutz.ioc.IocException: IocBean[class:org.nutz.dao.Dao] none ioc bean match class=org.nutz.dao.Dao
	at org.nutz.ioc.impl.NutIoc.getByType(NutIoc.java:419)
	at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:66)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
	... 31 more

8 回复

发完整启动日志

这是完整的日志

D:\apache-tomcat-8.0.53\bin\catalina.bat run
[2018-10-26 02:53:21,680] Artifact nutzdemo:war exploded: Waiting for server connection to start artifact deployment...
Using CATALINA_BASE:   "C:\Users\admin\.IntelliJIdea2018.2\system\tomcat\Unnamed_nutzdemo"
Using CATALINA_HOME:   "D:\apache-tomcat-8.0.53"
Using CATALINA_TMPDIR: "D:\apache-tomcat-8.0.53\temp"
Using JRE_HOME:        "D:\jdk1.8.0"
Using CLASSPATH:       "D:\apache-tomcat-8.0.53\bin\bootstrap.jar;D:\apache-tomcat-8.0.53\bin\tomcat-juli.jar"
26-Oct-2018 14:53:22.435 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.53
26-Oct-2018 14:53:22.437 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Jun 29 2018 14:42:45 UTC
26-Oct-2018 14:53:22.437 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.53.0
26-Oct-2018 14:53:22.437 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Windows 10
26-Oct-2018 14:53:22.437 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            10.0
26-Oct-2018 14:53:22.437 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
26-Oct-2018 14:53:22.437 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             D:\jdk1.8.0\jre
26-Oct-2018 14:53:22.440 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_181-b13
26-Oct-2018 14:53:22.440 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
26-Oct-2018 14:53:22.440 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         C:\Users\admin\.IntelliJIdea2018.2\system\tomcat\Unnamed_nutzdemo
26-Oct-2018 14:53:22.440 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         D:\apache-tomcat-8.0.53
26-Oct-2018 14:53:22.440 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Users\admin\.IntelliJIdea2018.2\system\tomcat\Unnamed_nutzdemo\conf\logging.properties
26-Oct-2018 14:53:22.440 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
26-Oct-2018 14:53:22.440 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=
26-Oct-2018 14:53:22.440 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099
26-Oct-2018 14:53:22.441 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
26-Oct-2018 14:53:22.441 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
26-Oct-2018 14:53:22.441 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1
26-Oct-2018 14:53:22.441 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
26-Oct-2018 14:53:22.441 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
26-Oct-2018 14:53:22.441 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
26-Oct-2018 14:53:22.441 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Users\admin\.IntelliJIdea2018.2\system\tomcat\Unnamed_nutzdemo
26-Oct-2018 14:53:22.441 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=D:\apache-tomcat-8.0.53
26-Oct-2018 14:53:22.441 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=D:\apache-tomcat-8.0.53\temp
26-Oct-2018 14:53:22.442 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.2.17 using APR version 1.6.3.
26-Oct-2018 14:53:22.442 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
26-Oct-2018 14:53:23.098 信息 [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized (OpenSSL 1.0.2o  27 Mar 2018)
26-Oct-2018 14:53:23.198 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-apr-8080"]
26-Oct-2018 14:53:23.211 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-apr-8009"]
26-Oct-2018 14:53:23.212 信息 [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1014 ms
26-Oct-2018 14:53:23.231 信息 [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
26-Oct-2018 14:53:23.231 信息 [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.53
26-Oct-2018 14:53:23.238 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-apr-8080"]
26-Oct-2018 14:53:23.252 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-apr-8009"]
26-Oct-2018 14:53:23.256 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in 43 ms
Connected to server
[2018-10-26 02:53:23,277] Artifact nutzdemo:war exploded: Artifact is being deployed, please wait...
26-Oct-2018 14:53:24.148 信息 [RMI TCP Connection(5)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
18-10-26 14:53:24.190 INFO [RMI TCP Connection(5)-127.0.0.1] Select SystemLog as Nutz.Log implement
18-10-26 14:53:24.346 INFO [RMI TCP Connection(5)-127.0.0.1] NutFilter[nutz] starting ...
18-10-26 14:53:24.365 DEBUG [RMI TCP Connection(5)-127.0.0.1] Locations count=3 time use 5ms
18-10-26 14:53:24.370 DEBUG [RMI TCP Connection(5)-127.0.0.1] Locations count=9 time use 5ms
18-10-26 14:53:24.379 DEBUG [RMI TCP Connection(5)-127.0.0.1] Loading by class org.nutz.mvc.impl.NutLoading
18-10-26 14:53:24.383 INFO [RMI TCP Connection(5)-127.0.0.1] Nutz Version : 1.r.63.r3-20171220 
18-10-26 14:53:24.383 INFO [RMI TCP Connection(5)-127.0.0.1] Nutz.Mvc[nutz] is initializing ...
18-10-26 14:53:24.384 DEBUG [RMI TCP Connection(5)-127.0.0.1] Web Container Information:
18-10-26 14:53:24.385 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - Default Charset : GBK
18-10-26 14:53:24.385 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - Current . path  : D:\apache-tomcat-8.0.53\bin\.
18-10-26 14:53:24.385 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - Java Version    : 1.8.0_181
18-10-26 14:53:24.386 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - File separator  : \
18-10-26 14:53:24.386 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - Timezone        : Asia/Shanghai
18-10-26 14:53:24.386 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - OS              : Windows 10 amd64
18-10-26 14:53:24.386 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - ServerInfo      : Apache Tomcat/8.0.53
18-10-26 14:53:24.387 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - Servlet API     : 3.1
18-10-26 14:53:24.387 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - ContextPath     : 
18-10-26 14:53:24.387 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - context.tempdir : C:\Users\admin\.IntelliJIdea2018.2\system\tomcat\Unnamed_nutzdemo\work\Catalina\localhost\ROOT
18-10-26 14:53:24.387 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - MainModule      : net.wendal.nutzbook.MainModule
18-10-26 14:53:24.388 DEBUG [RMI TCP Connection(5)-127.0.0.1] >> app.root = D:/CodeProject/nutzdemo/target/nutzdemo
18-10-26 14:53:24.462 DEBUG [RMI TCP Connection(5)-127.0.0.1] Using 95 castor for Castors
18-10-26 14:53:24.463 DEBUG [RMI TCP Connection(5)-127.0.0.1] @IocBy(type=org.nutz.mvc.ioc.provider.ComboIocProvider, args=["*anno", "net.wendal.nutzbook"],init=[])
18-10-26 14:53:24.494 INFO [RMI TCP Connection(5)-127.0.0.1]  > scan 'net.wendal.nutzbook'
18-10-26 14:53:24.500 DEBUG [RMI TCP Connection(5)-127.0.0.1] Found 4 resource by src( net/wendal/nutzbook/ ) , regex( ^.+[.]class$ )
18-10-26 14:53:24.506 INFO [RMI TCP Connection(5)-127.0.0.1]    > add 'userModule                              ' - net.wendal.nutzbook.controller.UserModule
18-10-26 14:53:24.515 INFO [RMI TCP Connection(5)-127.0.0.1]    > add 'user                                    ' - net.wendal.nutzbook.pojo.User
18-10-26 14:53:24.518 INFO [RMI TCP Connection(5)-127.0.0.1]    > add 'userService                             ' - net.wendal.nutzbook.service.UserService
18-10-26 14:53:24.525 INFO [RMI TCP Connection(5)-127.0.0.1] ... NutIoc init complete
18-10-26 14:53:24.529 INFO [RMI TCP Connection(5)-127.0.0.1] Build URL mapping by org.nutz.mvc.impl.UrlMappingImpl ...
18-10-26 14:53:24.532 DEBUG [RMI TCP Connection(5)-127.0.0.1] @Views(DefaultViewMaker.class)
18-10-26 14:53:24.538 DEBUG [RMI TCP Connection(5)-127.0.0.1] @ChainBy(org.nutz.mvc.impl.NutActionChainMaker)
18-10-26 14:53:24.547 DEBUG [RMI TCP Connection(5)-127.0.0.1] module class location 'file:/D:/CodeProject/nutzdemo/target/nutzdemo/WEB-INF/classes/'
18-10-26 14:53:24.547 DEBUG [RMI TCP Connection(5)-127.0.0.1]  > scan 'net.wendal.nutzbook'
18-10-26 14:53:24.549 DEBUG [RMI TCP Connection(5)-127.0.0.1] Found 4 resource by src( net/wendal/nutzbook/ ) , regex( ^.+[.]class$ )
18-10-26 14:53:24.552 DEBUG [RMI TCP Connection(5)-127.0.0.1]    >> add 'net.wendal.nutzbook.controller.UserModule'
18-10-26 14:53:24.553 DEBUG [RMI TCP Connection(5)-127.0.0.1] Use org.nutz.mvc.impl.NutEntryDeterminer as EntryMethodDeterminer
18-10-26 14:53:24.569 INFO [RMI TCP Connection(5)-127.0.0.1] Optional processor class not found, disabled : org.nutz.integration.shiro.NutShiroProcessor
18-10-26 14:53:24.582 INFO [RMI TCP Connection(5)-127.0.0.1] Optional processor class not found, disabled : org.nutz.plugins.validation.ValidationProcessor
18-10-26 14:53:24.601 DEBUG [RMI TCP Connection(5)-127.0.0.1]    '/selectAll'                >> (UserModule.java:34).selectAll        : List       | @Ok(json ) @Fail(null ) | by 0 Filters | (I:UTF-8/O:UTF-8)
18-10-26 14:53:24.604 DEBUG [RMI TCP Connection(5)-127.0.0.1]    '/selectById/?'             >> (UserModule.java:41).selectById       : Object     | @Ok(json ) @Fail(null ) | by 0 Filters | (I:UTF-8/O:UTF-8)
18-10-26 14:53:24.604 INFO [RMI TCP Connection(5)-127.0.0.1] Found 2 module methods
18-10-26 14:53:24.605 DEBUG [RMI TCP Connection(5)-127.0.0.1] @Localization not define
18-10-26 14:53:24.607 INFO [RMI TCP Connection(5)-127.0.0.1] Nutz.Mvc[nutz] is up in 220ms
[2018-10-26 02:53:24,625] Artifact nutzdemo:war exploded: Artifact is deployed successfully
[2018-10-26 02:53:24,625] Artifact nutzdemo:war exploded: Deploy took 1,348 milliseconds
18-10-26 14:53:32.228 DEBUG [http-apr-8080-exec-9] Found mapping for [GET] path=/selectById/2 : UserModule.selectById(UserModule.java:41)
18-10-26 14:53:32.230 DEBUG [http-apr-8080-exec-9] Get 'userModule'<class net.wendal.nutzbook.controller.UserModule>
18-10-26 14:53:32.235 DEBUG [http-apr-8080-exec-9] Load AopConfigure for anno=org.nutz.ioc.aop.Aop by type=org.nutz.ioc.aop.config.impl.AnnotationAopConfigration
18-10-26 14:53:32.236 DEBUG [http-apr-8080-exec-9] 	 >> Load definition name=userModule
18-10-26 14:53:32.236 DEBUG [http-apr-8080-exec-9] Found IocObject(userModule) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
18-10-26 14:53:32.236 DEBUG [http-apr-8080-exec-9] 	 >> Make...'userModule'<class net.wendal.nutzbook.controller.UserModule>
18-10-26 14:53:32.237 DEBUG [http-apr-8080-exec-9] Save object 'userModule' to [app] 
18-10-26 14:53:32.239 DEBUG [http-apr-8080-exec-9] Load class net.wendal.nutzbook.controller.UserModule without AOP
18-10-26 14:53:32.251 DEBUG [http-apr-8080-exec-9] Get 'userService'<class net.wendal.nutzbook.service.UserService>
18-10-26 14:53:32.251 DEBUG [http-apr-8080-exec-9] 	 >> Load definition name=userService
18-10-26 14:53:32.252 DEBUG [http-apr-8080-exec-9] Found IocObject(userService) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
18-10-26 14:53:32.252 DEBUG [http-apr-8080-exec-9] 	 >> Make...'userService'<class net.wendal.nutzbook.service.UserService>
18-10-26 14:53:32.252 DEBUG [http-apr-8080-exec-9] Save object 'userService' to [app] 
18-10-26 14:53:32.252 DEBUG [http-apr-8080-exec-9] Load class net.wendal.nutzbook.service.UserService without AOP
18-10-26 14:53:32.259 WARN [http-apr-8080-exec-9] Error@/selectById/2 :
org.nutz.ioc.IocException: IocBean[userModule] throw Exception when creating
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:152)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:231)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:260)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:116)
18-10-26 14:53:32.258 DEBUG [http-apr-8080-exec-9] name=dao not found, search for type=org.nutz.dao.Dao
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
18-10-26 14:53:32.259 DEBUG [http-apr-8080-exec-9] Found IocObject(user) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
18-10-26 14:53:32.259 DEBUG [http-apr-8080-exec-9] Remove object 'userModule' from [app] 
	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:94)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1152)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2527)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2516)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: IocBean[userModule] fail at field=[dao]
	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)
	... 29 more
Caused by: org.nutz.ioc.IocException: IocBean[class:org.nutz.dao.Dao] none ioc bean match class=org.nutz.dao.Dao
	at org.nutz.ioc.impl.NutIoc.getByType(NutIoc.java:419)
	at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:66)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
	... 31 more
26-Oct-2018 14:53:33.245 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory D:\apache-tomcat-8.0.53\webapps\manager
26-Oct-2018 14:53:33.281 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory D:\apache-tomcat-8.0.53\webapps\manager has finished in 36 ms

@IocBy(type=org.nutz.mvc.ioc.provider.ComboIocProvider, args=["*anno", "net.wendal.nutzbook"],init=[])

缺了ioc js的配置东西

应该是

@IocBy(args={"*js", "ioc/","*anno", "net.wendal.nutzbook"})

http://nutzbook.wendal.net/setup30mins/configure_iocby.html

我的MainModule:

package net.wendal.nutzbook;

import org.nutz.mvc.annotation.IocBy;
import org.nutz.mvc.annotation.Modules;
import org.nutz.mvc.ioc.provider.ComboIocProvider;

@IocBy(type = ComboIocProvider.class, args = {
        "*js","datasource.js",
        "*anno","net.wendal.nutzbook"
})
@Modules(scanPackage = true)
public class MainModule {
}



然后@IocBy修改后的完整日志:

D:\apache-tomcat-8.0.53\bin\catalina.bat run
[2018-10-26 02:59:48,240] Artifact nutzdemo:war exploded: Waiting for server connection to start artifact deployment...
Using CATALINA_BASE:   "C:\Users\admin\.IntelliJIdea2018.2\system\tomcat\Unnamed_nutzdemo"
Using CATALINA_HOME:   "D:\apache-tomcat-8.0.53"
Using CATALINA_TMPDIR: "D:\apache-tomcat-8.0.53\temp"
Using JRE_HOME:        "D:\jdk1.8.0"
Using CLASSPATH:       "D:\apache-tomcat-8.0.53\bin\bootstrap.jar;D:\apache-tomcat-8.0.53\bin\tomcat-juli.jar"
26-Oct-2018 14:59:49.002 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.53
26-Oct-2018 14:59:49.004 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Jun 29 2018 14:42:45 UTC
26-Oct-2018 14:59:49.004 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.53.0
26-Oct-2018 14:59:49.004 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Windows 10
26-Oct-2018 14:59:49.004 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            10.0
26-Oct-2018 14:59:49.004 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
26-Oct-2018 14:59:49.004 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             D:\jdk1.8.0\jre
26-Oct-2018 14:59:49.004 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_181-b13
26-Oct-2018 14:59:49.004 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
26-Oct-2018 14:59:49.004 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         C:\Users\admin\.IntelliJIdea2018.2\system\tomcat\Unnamed_nutzdemo
26-Oct-2018 14:59:49.004 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         D:\apache-tomcat-8.0.53
26-Oct-2018 14:59:49.004 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Users\admin\.IntelliJIdea2018.2\system\tomcat\Unnamed_nutzdemo\conf\logging.properties
26-Oct-2018 14:59:49.005 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
26-Oct-2018 14:59:49.005 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=
26-Oct-2018 14:59:49.007 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099
26-Oct-2018 14:59:49.007 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
26-Oct-2018 14:59:49.007 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
26-Oct-2018 14:59:49.007 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1
26-Oct-2018 14:59:49.007 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
26-Oct-2018 14:59:49.007 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
26-Oct-2018 14:59:49.007 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
26-Oct-2018 14:59:49.007 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Users\admin\.IntelliJIdea2018.2\system\tomcat\Unnamed_nutzdemo
26-Oct-2018 14:59:49.007 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=D:\apache-tomcat-8.0.53
26-Oct-2018 14:59:49.007 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=D:\apache-tomcat-8.0.53\temp
26-Oct-2018 14:59:49.008 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.2.17 using APR version 1.6.3.
26-Oct-2018 14:59:49.008 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
26-Oct-2018 14:59:49.674 信息 [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized (OpenSSL 1.0.2o  27 Mar 2018)
26-Oct-2018 14:59:49.774 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-apr-8080"]
26-Oct-2018 14:59:49.780 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-apr-8009"]
26-Oct-2018 14:59:49.781 信息 [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1013 ms
26-Oct-2018 14:59:49.807 信息 [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
26-Oct-2018 14:59:49.807 信息 [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.53
26-Oct-2018 14:59:49.814 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-apr-8080"]
26-Oct-2018 14:59:49.832 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-apr-8009"]
26-Oct-2018 14:59:49.836 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in 55 ms
Connected to server
[2018-10-26 02:59:50,323] Artifact nutzdemo:war exploded: Artifact is being deployed, please wait...
26-Oct-2018 14:59:51.218 信息 [RMI TCP Connection(5)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
18-10-26 14:59:51.260 INFO [RMI TCP Connection(5)-127.0.0.1] Select SystemLog as Nutz.Log implement
18-10-26 14:59:51.414 INFO [RMI TCP Connection(5)-127.0.0.1] NutFilter[nutz] starting ...
18-10-26 14:59:51.434 DEBUG [RMI TCP Connection(5)-127.0.0.1] Locations count=3 time use 4ms
18-10-26 14:59:51.439 DEBUG [RMI TCP Connection(5)-127.0.0.1] Locations count=9 time use 3ms
18-10-26 14:59:51.449 DEBUG [RMI TCP Connection(5)-127.0.0.1] Loading by class org.nutz.mvc.impl.NutLoading
18-10-26 14:59:51.454 INFO [RMI TCP Connection(5)-127.0.0.1] Nutz Version : 1.r.63.r3-20171220 
18-10-26 14:59:51.454 INFO [RMI TCP Connection(5)-127.0.0.1] Nutz.Mvc[nutz] is initializing ...
18-10-26 14:59:51.454 DEBUG [RMI TCP Connection(5)-127.0.0.1] Web Container Information:
18-10-26 14:59:51.456 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - Default Charset : GBK
18-10-26 14:59:51.456 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - Current . path  : D:\apache-tomcat-8.0.53\bin\.
18-10-26 14:59:51.456 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - Java Version    : 1.8.0_181
18-10-26 14:59:51.456 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - File separator  : \
18-10-26 14:59:51.457 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - Timezone        : Asia/Shanghai
18-10-26 14:59:51.457 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - OS              : Windows 10 amd64
18-10-26 14:59:51.457 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - ServerInfo      : Apache Tomcat/8.0.53
18-10-26 14:59:51.457 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - Servlet API     : 3.1
18-10-26 14:59:51.458 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - ContextPath     : 
18-10-26 14:59:51.458 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - context.tempdir : C:\Users\admin\.IntelliJIdea2018.2\system\tomcat\Unnamed_nutzdemo\work\Catalina\localhost\ROOT
18-10-26 14:59:51.458 DEBUG [RMI TCP Connection(5)-127.0.0.1]  - MainModule      : net.wendal.nutzbook.MainModule
18-10-26 14:59:51.459 DEBUG [RMI TCP Connection(5)-127.0.0.1] >> app.root = D:/CodeProject/nutzdemo/target/nutzdemo
18-10-26 14:59:51.532 DEBUG [RMI TCP Connection(5)-127.0.0.1] Using 95 castor for Castors
18-10-26 14:59:51.533 DEBUG [RMI TCP Connection(5)-127.0.0.1] @IocBy(type=org.nutz.mvc.ioc.provider.ComboIocProvider, args=["*js", "datasource.js", "*anno", "net.wendal.nutzbook"],init=[])
18-10-26 14:59:51.569 DEBUG [RMI TCP Connection(5)-127.0.0.1] Found 1 resource by src( datasource.js ) , regex( ^(.+[.])(js|json)$ )
18-10-26 14:59:51.569 DEBUG [RMI TCP Connection(5)-127.0.0.1] loading [datasource.js]
18-10-26 14:59:51.572 DEBUG [RMI TCP Connection(5)-127.0.0.1] Loaded 2 bean define from path=[datasource.js] --> [dataSource, dao]
18-10-26 14:59:51.580 INFO [RMI TCP Connection(5)-127.0.0.1]  > scan 'net.wendal.nutzbook'
18-10-26 14:59:51.582 DEBUG [RMI TCP Connection(5)-127.0.0.1] Found 4 resource by src( net/wendal/nutzbook/ ) , regex( ^.+[.]class$ )
18-10-26 14:59:51.587 INFO [RMI TCP Connection(5)-127.0.0.1]    > add 'userModule                              ' - net.wendal.nutzbook.controller.UserModule
18-10-26 14:59:51.597 INFO [RMI TCP Connection(5)-127.0.0.1]    > add 'user                                    ' - net.wendal.nutzbook.pojo.User
18-10-26 14:59:51.601 INFO [RMI TCP Connection(5)-127.0.0.1]    > add 'userService                             ' - net.wendal.nutzbook.service.UserService
18-10-26 14:59:51.621 INFO [RMI TCP Connection(5)-127.0.0.1] ... NutIoc init complete
18-10-26 14:59:51.625 INFO [RMI TCP Connection(5)-127.0.0.1] Build URL mapping by org.nutz.mvc.impl.UrlMappingImpl ...
18-10-26 14:59:51.628 DEBUG [RMI TCP Connection(5)-127.0.0.1] @Views(DefaultViewMaker.class)
18-10-26 14:59:51.633 DEBUG [RMI TCP Connection(5)-127.0.0.1] @ChainBy(org.nutz.mvc.impl.NutActionChainMaker)
18-10-26 14:59:51.642 DEBUG [RMI TCP Connection(5)-127.0.0.1] module class location 'file:/D:/CodeProject/nutzdemo/target/nutzdemo/WEB-INF/classes/'
18-10-26 14:59:51.643 DEBUG [RMI TCP Connection(5)-127.0.0.1]  > scan 'net.wendal.nutzbook'
18-10-26 14:59:51.645 DEBUG [RMI TCP Connection(5)-127.0.0.1] Found 4 resource by src( net/wendal/nutzbook/ ) , regex( ^.+[.]class$ )
18-10-26 14:59:51.649 DEBUG [RMI TCP Connection(5)-127.0.0.1]    >> add 'net.wendal.nutzbook.controller.UserModule'
18-10-26 14:59:51.649 DEBUG [RMI TCP Connection(5)-127.0.0.1] Use org.nutz.mvc.impl.NutEntryDeterminer as EntryMethodDeterminer
18-10-26 14:59:51.666 INFO [RMI TCP Connection(5)-127.0.0.1] Optional processor class not found, disabled : org.nutz.integration.shiro.NutShiroProcessor
18-10-26 14:59:51.679 INFO [RMI TCP Connection(5)-127.0.0.1] Optional processor class not found, disabled : org.nutz.plugins.validation.ValidationProcessor
18-10-26 14:59:51.697 DEBUG [RMI TCP Connection(5)-127.0.0.1]    '/selectAll'                >> (UserModule.java:34).selectAll        : List       | @Ok(json ) @Fail(null ) | by 0 Filters | (I:UTF-8/O:UTF-8)
18-10-26 14:59:51.700 DEBUG [RMI TCP Connection(5)-127.0.0.1]    '/selectById/?'             >> (UserModule.java:41).selectById       : Object     | @Ok(json ) @Fail(null ) | by 0 Filters | (I:UTF-8/O:UTF-8)
18-10-26 14:59:51.701 INFO [RMI TCP Connection(5)-127.0.0.1] Found 2 module methods
18-10-26 14:59:51.702 DEBUG [RMI TCP Connection(5)-127.0.0.1] @Localization not define
18-10-26 14:59:51.704 INFO [RMI TCP Connection(5)-127.0.0.1] Nutz.Mvc[nutz] is up in 246ms
[2018-10-26 02:59:51,721] Artifact nutzdemo:war exploded: Artifact is deployed successfully
[2018-10-26 02:59:51,721] Artifact nutzdemo:war exploded: Deploy took 1,398 milliseconds
18-10-26 14:59:55.475 DEBUG [http-apr-8080-exec-9] Found mapping for [GET] path=/selectById/2 : UserModule.selectById(UserModule.java:41)
18-10-26 14:59:55.477 DEBUG [http-apr-8080-exec-9] Get 'userModule'<class net.wendal.nutzbook.controller.UserModule>
18-10-26 14:59:55.483 DEBUG [http-apr-8080-exec-9] Load AopConfigure for anno=org.nutz.ioc.aop.Aop by type=org.nutz.ioc.aop.config.impl.AnnotationAopConfigration
18-10-26 14:59:55.486 DEBUG [http-apr-8080-exec-9] 	 >> Load definition name=userModule
18-10-26 14:59:55.486 DEBUG [http-apr-8080-exec-9] Found IocObject(userModule) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
18-10-26 14:59:55.487 DEBUG [http-apr-8080-exec-9] 	 >> Make...'userModule'<class net.wendal.nutzbook.controller.UserModule>
18-10-26 14:59:55.489 DEBUG [http-apr-8080-exec-9] Save object 'userModule' to [app] 
18-10-26 14:59:55.492 DEBUG [http-apr-8080-exec-9] Load class net.wendal.nutzbook.controller.UserModule without AOP
18-10-26 14:59:55.506 DEBUG [http-apr-8080-exec-9] Get 'userService'<class net.wendal.nutzbook.service.UserService>
18-10-26 14:59:55.506 DEBUG [http-apr-8080-exec-9] 	 >> Load definition name=userService
18-10-26 14:59:55.506 DEBUG [http-apr-8080-exec-9] Found IocObject(userService) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
18-10-26 14:59:55.506 DEBUG [http-apr-8080-exec-9] 	 >> Make...'userService'<class net.wendal.nutzbook.service.UserService>
18-10-26 14:59:55.506 DEBUG [http-apr-8080-exec-9] Save object 'userService' to [app] 
18-10-26 14:59:55.507 DEBUG [http-apr-8080-exec-9] Load class net.wendal.nutzbook.service.UserService without AOP
18-10-26 14:59:55.510 DEBUG [http-apr-8080-exec-9] Get 'dao'<interface org.nutz.dao.Dao>
18-10-26 14:59:55.511 DEBUG [http-apr-8080-exec-9] 	 >> Load definition name=dao
18-10-26 14:59:55.511 DEBUG [http-apr-8080-exec-9] Found IocObject(dao) in JsonLoader(paths=[datasource.js])
18-10-26 14:59:55.511 DEBUG [http-apr-8080-exec-9] 	 >> Make...'dao'<interface org.nutz.dao.Dao>
18-10-26 14:59:55.512 DEBUG [http-apr-8080-exec-9] Save object 'dao' to [app] 
18-10-26 14:59:55.515 DEBUG [http-apr-8080-exec-9] Get 'dataSource'<>
18-10-26 14:59:55.515 DEBUG [http-apr-8080-exec-9] 	 >> Load definition name=dataSource
18-10-26 14:59:55.515 DEBUG [http-apr-8080-exec-9] Found IocObject(dataSource) in JsonLoader(paths=[datasource.js])
18-10-26 14:59:55.516 DEBUG [http-apr-8080-exec-9] 	 >> Make...'dataSource'<>
18-10-26 14:59:55.516 DEBUG [http-apr-8080-exec-9] Save object 'dataSource' to [app] 
18-10-26 14:59:55.541 DEBUG [http-apr-8080-exec-9] Load class com.alibaba.druid.pool.DruidDataSource without AOP
18-10-26 14:59:55.826 DEBUG [http-apr-8080-exec-9] Remove object 'dataSource' from [app] 
18-10-26 14:59:55.826 DEBUG [http-apr-8080-exec-9] Remove object 'dao' from [app] 
18-10-26 14:59:55.826 DEBUG [http-apr-8080-exec-9] Remove object 'userModule' from [app] 
18-10-26 14:59:55.826 WARN [http-apr-8080-exec-9] Error@/selectById/2 :
org.nutz.ioc.IocException: IocBean[userModule] throw Exception when creating
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:152)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:231)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:260)
	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:94)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1152)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2527)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2516)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: IocBean[userModule] fail at field=[dao]
	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)
	... 29 more
Caused by: org.nutz.ioc.IocException: IocBean[dao -> dataSource] throw Exception when creating
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:152)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:231)
	at org.nutz.ioc.val.ReferValue.get(ReferValue.java:24)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:64)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:231)
	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: Fail to eval Injector for field: 'user'
	at org.nutz.lang.Lang.wrapThrow(Lang.java:168)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:131)
	... 37 more
Caused by: java.lang.RuntimeException: java.lang.NoSuchFieldException: Can NOT find field [user] in class [com.alibaba.druid.pool.DruidDataSource] and it's parents classes
	at org.nutz.lang.Lang.wrapThrow(Lang.java:185)
	at org.nutz.lang.Mirror.getInjecting(Mirror.java:1068)
	at org.nutz.ioc.weaver.FieldInjector.create(FieldInjector.java:17)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:128)
	... 37 more
Caused by: java.lang.NoSuchFieldException: Can NOT find field [user] in class [com.alibaba.druid.pool.DruidDataSource] and it's parents classes
	at org.nutz.lang.Mirror.getField(Mirror.java:489)
	at org.nutz.lang.Mirror.getInjecting(Mirror.java:1059)
	... 39 more
26-Oct-2018 14:59:59.821 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory D:\apache-tomcat-8.0.53\webapps\manager
26-Oct-2018 14:59:59.871 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory D:\apache-tomcat-8.0.53\webapps\manager has finished in 49 ms

DruidDataSource的用户名属性叫 username , 不是 user

我擦!!!好了!! 那UserModule里的 @Inject注解的dao,是从哪里注入的?那个datasource.js文件吗?
如果没有这个文件还能不能注入?

方式有很多, 走js声明, 走注解声明(例如 https://nutz.cn/yvr/t/v0ohtg6vfsgoorqd0dmlqtk07h ), 走xml, 自定义IocLoader, 等等方式...

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