NutzCN Logo
问答 求指教!!!org.nutz.ioc.ObjectLoadException: Object 'userModule' without define!
发布于 3251天前 作者 qq_0f41593b 4914 次浏览 复制 上一个帖子 下一个帖子
标签:

2016-1-28 9:2:35.875 WARN [http-apr-8080-exec-9] Error@/user/count :
org.nutz.ioc.IocException: Object 'userModule' without define! For object [userModule] - type:[class nutz.module.UserModule]

我是照着入门手册一步步来的,不知道什么原因,MainStep里面的初始化默认根用户成功执行了,执行UserModule里的count方法报这个错.

19 回复

@wendal MainModule里面是这样的,不对吗?
@SetupBy(value = MainSetup.class)
@IocBy(type=ComboIocProvider.class, args={"*js", "ioc/", "*anno", "net.wendal.nutzbook","*tx"})
@Modules(scanPackage = true)
public class MainModule {

}

@qq_0f41593b 然后看UserModule是否加了@IocBean

@wendal UserModule的内容是这样的
@IocBean
@At("/user")
@Ok("json")
@Fail("http:500")
public class UserModule {
@Inject
protected Dao dao;

@At
public int count() {
    return dao.count(User.class);
}

}

贴启动日志

@wendal
2016-1-28 9:57:15.995 DEBUG [RMI TCP Connection(5)-127.0.0.1] MainModule: <nutz.MainModule>
2016-1-28 9:57:16.5 DEBUG [RMI TCP Connection(5)-127.0.0.1] Loading by class org.nutz.mvc.impl.NutLoading
2016-1-28 9:57:16.8 INFO [RMI TCP Connection(5)-127.0.0.1] Nutz Version : 1.r.54
2016-1-28 9:57:16.9 INFO [RMI TCP Connection(5)-127.0.0.1] Nutz.Mvc[nutz] is initializing ...
2016-1-28 9:57:16.9 DEBUG [RMI TCP Connection(5)-127.0.0.1] Web Container Information:
2016-1-28 9:57:16.11 DEBUG [RMI TCP Connection(5)-127.0.0.1] - Default Charset : GBK
2016-1-28 9:57:16.11 DEBUG [RMI TCP Connection(5)-127.0.0.1] - Current . path : D:\tomcat9\bin.
2016-1-28 9:57:16.11 DEBUG [RMI TCP Connection(5)-127.0.0.1] - Java Version : 1.8.0_40
2016-1-28 9:57:16.12 DEBUG [RMI TCP Connection(5)-127.0.0.1] - File separator : \
2016-1-28 9:57:16.12 DEBUG [RMI TCP Connection(5)-127.0.0.1] - Timezone : Asia/Shanghai
2016-1-28 9:57:16.12 DEBUG [RMI TCP Connection(5)-127.0.0.1] - OS : Windows 7 amd64
2016-1-28 9:57:16.13 DEBUG [RMI TCP Connection(5)-127.0.0.1] - ServerInfo : Apache Tomcat/9.0.0.M1
2016-1-28 9:57:16.13 DEBUG [RMI TCP Connection(5)-127.0.0.1] - Servlet API : 4.0
2016-1-28 9:57:16.13 DEBUG [RMI TCP Connection(5)-127.0.0.1] - ContextPath : /ytj
2016-1-28 9:57:16.14 DEBUG [RMI TCP Connection(5)-127.0.0.1] MainModule: <nutz.MainModule>
2016-1-28 9:57:16.15 DEBUG [RMI TCP Connection(5)-127.0.0.1] >> app.root = D:/tomcat9/webapps/ytj
2016-1-28 9:57:16.93 DEBUG [RMI TCP Connection(5)-127.0.0.1] Using 94 castor for Castors
2016-1-28 9:57:16.98 DEBUG [RMI TCP Connection(5)-127.0.0.1] @IocBy(type=org.nutz.mvc.ioc.provider.ComboIocProvider, args=["*js", "ioc/", "*anno", "net.wendal.nutzbook", "*tx"],init=[])
2016-1-28 9:57:16.119 DEBUG [RMI TCP Connection(5)-127.0.0.1] Found 1 resource by src( ioc/ ) , regex( ^(.+[.])(js|json)$ )
2016-1-28 9:57:16.120 DEBUG [RMI TCP Connection(5)-127.0.0.1] loading ioc js config from [dao.js]
2016-1-28 9:57:16.127 DEBUG [RMI TCP Connection(5)-127.0.0.1] Loaded 2 bean define from path=[ioc/] --> [dataSource, dao]
2016-1-28 9:57:16.130 WARN [RMI TCP Connection(5)-127.0.0.1] NONE Annotation-Class found!! Check your ioc configure!! packages=[net.wendal.nutzbook]
2016-1-28 9:57:16.130 DEBUG [RMI TCP Connection(5)-127.0.0.1] Found 0 resource by src( net/wendal/nutzbook/ ) , regex( ^.+[.]class$ )
2016-1-28 9:57:16.131 DEBUG [RMI TCP Connection(5)-127.0.0.1] Loaded 5 bean define from reader --
[txREPEATABLE_READ, txSERIALIZABLE, txNONE, txREAD_UNCOMMITTED, txREAD_COMMITTED]
2016-1-28 9:57:16.134 INFO [RMI TCP Connection(5)-127.0.0.1] NutIoc init begin ...
2016-1-28 9:57:16.136 INFO [RMI TCP Connection(5)-127.0.0.1] ... NutIoc init complete

@wendal
2016-1-28 9:57:16.137 DEBUG [RMI TCP Connection(5)-127.0.0.1] MainModule: <nutz.MainModule>
2016-1-28 9:57:16.142 INFO [RMI TCP Connection(5)-127.0.0.1] Build URL mapping by org.nutz.mvc.impl.UrlMappingImpl ...
2016-1-28 9:57:16.145 DEBUG [RMI TCP Connection(5)-127.0.0.1] @Views(DefaultViewMaker)
2016-1-28 9:57:16.155 DEBUG [RMI TCP Connection(5)-127.0.0.1] @ChainBy(org.nutz.mvc.impl.NutActionChainMaker)
2016-1-28 9:57:16.165 DEBUG [RMI TCP Connection(5)-127.0.0.1] module class location 'file:/D:/tomcat9/webapps/ytj/WEB-INF/classes/'
2016-1-28 9:57:16.165 DEBUG [RMI TCP Connection(5)-127.0.0.1] > scan 'nutz'
2016-1-28 9:57:16.168 DEBUG [RMI TCP Connection(5)-127.0.0.1] Found 4 resource by src( nutz/ ) , regex( ^.+[.]class$ )
2016-1-28 9:57:16.173 DEBUG [RMI TCP Connection(5)-127.0.0.1] >> add 'nutz.module.UserModule'
2016-1-28 9:57:16.185 WARN [RMI TCP Connection(5)-127.0.0.1] Moudle with @InjectName('userModule') or @IocBean('userModule') but no such ioc bean found!! Pls check your ioc configure!!
2016-1-28 9:57:16.186 INFO [RMI TCP Connection(5)-127.0.0.1] Optional processor class not found, disabled : org.nutz.integration.shiro.NutShiroProcessor
2016-1-28 9:57:16.193 INFO [RMI TCP Connection(5)-127.0.0.1] Optional processor class not found, disabled : org.nutz.plugins.validation.ValidationProcessor
2016-1-28 9:57:16.206 DEBUG [RMI TCP Connection(5)-127.0.0.1] '/user/count' >> UserModule.count(...) : int | @Ok(json ) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2016-1-28 9:57:16.207 INFO [RMI TCP Connection(5)-127.0.0.1] Found 1 module methods
2016-1-28 9:57:16.208 DEBUG [RMI TCP Connection(5)-127.0.0.1] @Localization not define
2016-1-28 9:57:16.209 INFO [RMI TCP Connection(5)-127.0.0.1] Setup application...
2016-1-28 9:57:16.210 DEBUG [RMI TCP Connection(5)-127.0.0.1] Get 'dao'<interface org.nutz.dao.Dao>
2016-1-28 9:57:16.211 DEBUG [RMI TCP Connection(5)-127.0.0.1] >> Load definition
2016-1-28 9:57:16.213 DEBUG [RMI TCP Connection(5)-127.0.0.1] Loading define for name=dao
2016-1-28 9:57:16.221 DEBUG [RMI TCP Connection(5)-127.0.0.1] Found IocObject(dao) in IocLoader(JsonLoader@1825049663)
2016-1-28 9:57:16.221 DEBUG [RMI TCP Connection(5)-127.0.0.1] >> Make...'dao'<interface org.nutz.dao.Dao>
2016-1-28 9:57:16.239 DEBUG [RMI TCP Connection(5)-127.0.0.1] Load class org.nutz.dao.impl.NutDao without AOP
2016-1-28 9:57:16.240 DEBUG [RMI TCP Connection(5)-127.0.0.1] Save object 'dao' to [app]
2016-1-28 9:57:16.243 DEBUG [RMI TCP Connection(5)-127.0.0.1] Get 'dataSource'<>
2016-1-28 9:57:16.243 DEBUG [RMI TCP Connection(5)-127.0.0.1] >> Load definition
2016-1-28 9:57:16.243 DEBUG [RMI TCP Connection(5)-127.0.0.1] Loading define for name=dataSource
2016-1-28 9:57:16.253 DEBUG [RMI TCP Connection(5)-127.0.0.1] Found IocObject(dataSource) in IocLoader(JsonLoader@1825049663)
2016-1-28 9:57:16.253 DEBUG [RMI TCP Connection(5)-127.0.0.1] >> Make...'dataSource'<>
2016-1-28 9:57:16.284 DEBUG [RMI TCP Connection(5)-127.0.0.1] Load class com.alibaba.druid.pool.DruidDataSource without AOP
2016-1-28 9:57:16.285 DEBUG [RMI TCP Connection(5)-127.0.0.1] Save object 'dataSource' to [app]
28-Jan-2016 09:57:16.355 INFO [RMI TCP Connection(5)-127.0.0.1] com.alibaba.druid.pool.DruidDataSource.info {dataSource-1} inited
2016-1-28 9:57:16.356 DEBUG [RMI TCP Connection(5)-127.0.0.1] Get 'dataSource'<>
2016-1-28 9:57:16.366 DEBUG [RMI TCP Connection(5)-127.0.0.1] NutDao[_selfId=0] init ...
2016-1-28 9:57:16.394 INFO [RMI TCP Connection(5)-127.0.0.1] Init file-pool by: C:\Users\Administrator/.nutz/tmp/dao/ [200000]
2016-1-28 9:57:16.395 DEBUG [RMI TCP Connection(5)-127.0.0.1] file-pool.home: 'C:\Users\Administrator.nutz\tmp\dao'
2016-1-28 9:57:16.396 INFO [RMI TCP Connection(5)-127.0.0.1] file-pool.cursor: 0
2016-1-28 9:57:16.412 DEBUG [RMI TCP Connection(5)-127.0.0.1] Jdbcs init complete
2016-1-28 9:57:16.412 INFO [RMI TCP Connection(5)-127.0.0.1] Get Connection from DataSource for JdbcExpert, if I lock at here, check your database server and configure

你把package名改了

@wendal
Thu Jan 28 09:57:16 CST 2016 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
2016-1-28 9:57:16.746 DEBUG [RMI TCP Connection(5)-127.0.0.1] JDBC Driver --> mysql-connector-java-5.1.38 ( Revision: fe541c166cec739c74cc727c5da96c1028b4834a )
2016-1-28 9:57:16.746 DEBUG [RMI TCP Connection(5)-127.0.0.1] JDBC Name --> MySQL Connector Java
2016-1-28 9:57:16.746 DEBUG [RMI TCP Connection(5)-127.0.0.1] JDBC URL --> jdbc:mysql://127.0.0.1:3306/hit
2016-1-28 9:57:16.753 DEBUG [RMI TCP Connection(5)-127.0.0.1] Mysql : character_set_client=latin1
2016-1-28 9:57:16.753 DEBUG [RMI TCP Connection(5)-127.0.0.1] Mysql : character_set_connection=latin1
2016-1-28 9:57:16.753 DEBUG [RMI TCP Connection(5)-127.0.0.1] Mysql : character_set_database=latin1
2016-1-28 9:57:16.754 DEBUG [RMI TCP Connection(5)-127.0.0.1] Mysql : character_set_filesystem=binary
2016-1-28 9:57:16.754 DEBUG [RMI TCP Connection(5)-127.0.0.1] Mysql : character_set_results=
2016-1-28 9:57:16.754 DEBUG [RMI TCP Connection(5)-127.0.0.1] Mysql : character_set_server=latin1
2016-1-28 9:57:16.754 DEBUG [RMI TCP Connection(5)-127.0.0.1] Mysql : character_set_system=utf8
2016-1-28 9:57:16.754 DEBUG [RMI TCP Connection(5)-127.0.0.1] Mysql : character_sets_dir=D:\Program Files\mysql-5.7.10-winx64\share\charsets\
2016-1-28 9:57:16.754 DEBUG [RMI TCP Connection(5)-127.0.0.1] Database info --> MYSQL:[MySQL - 5.7.10]
2016-1-28 9:57:16.763 DEBUG [RMI TCP Connection(5)-127.0.0.1] Found 0 resource by src( net/wendal/nutzbook/ ) , regex( ^.+[.]class$ )
2016-1-28 9:57:16.820 DEBUG [RMI TCP Connection(5)-127.0.0.1] SELECT COUNT(*) FROM t_user
2016-1-28 9:57:16.821 INFO [RMI TCP Connection(5)-127.0.0.1] Nutz.Mvc[nutz] is up in 807ms

那么IocBy的配置要对应上

@wendal 厉害厉害,谢谢啊 可以了

2016-8-29 2:43:41 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: E:\programming software\MyEclipce\binary\com.sun.java.jdk.win32.x86_64_1.6.0.u43\bin;E:\programming software\MyEclipce\plugins\com.genuitec.eclipse.easie.tomcat7.myeclipse_11.0.0.me201302261706\tomcat\bin
2016-8-29 2:43:41 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-bio-8080"]
2016-8-29 2:43:41 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-bio-8009"]
2016-8-29 2:43:41 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 547 ms
2016-8-29 2:43:41 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
2016-8-29 2:43:41 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.30
2016-8-29 2:43:41 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory G:\Project.metadata.me_tcat7\webapps\nuz
ALL Nutz Log via Log4jLogAdapter
2016-08-29 02:43:42,394 [localhost-startStop-1] INFO org.nutz.log.Logs - Nutz is licensed under the Apache License, Version 2.0 .
Report bugs : https://github.com/nutzam/nutz/issues
2016-08-29 02:43:42,401 [localhost-startStop-1] INFO org.nutz.mvc.NutFilter - NutFilter[nutz] starting ...
2016-08-29 02:43:42,605 [localhost-startStop-1] DEBUG org.nutz.resource.Scans - Locations for Scans:
[JarResourceLocation [jarPath=E:\programming software\MyEclipce\binary\com.sun.java.jdk.win32.x86_64_1.6.0.u43\lib\tools.jar], FileSystemResourceLocation [root=G:\Project.metadata.me_tcat7\webapps\nuz\WEB-INF\classes], FileSystemResourceLocation [root=E:\programming software\MyEclipce\plugins\com.genuitec.eclipse.easie.tomcat7.myeclipse_11.0.0.me201302261706\tomcat\bin], JarResourceLocation [jarPath=E:\programming software\MyEclipce\plugins\com.genuitec.eclipse.easie.tomcat7.myeclipse_11.0.0.me201302261706\tomcat\bin\tomcat-juli.jar], JarResourceLocation [jarPath=G:\Project.metadata.me_tcat7\webapps\nuz\WEB-INF\lib\nutz-1.b.53.jar], JarResourceLocation [jarPath=E:\programming software\MyEclipce\plugins\com.genuitec.eclipse.easie.tomcat7.myeclipse_11.0.0.me201302261706\tomcat\bin\bootstrap.jar]]
2016-08-29 02:43:42,755 [localhost-startStop-1] DEBUG org.nutz.resource.Scans - Locations for Scans:
[JarResourceLocation [jarPath=G:\Project.metadata.me_tcat7\webapps\nuz\WEB-INF\lib\jstl.jar], JarResourceLocation [jarPath=G:\Project.metadata.me_tcat7\webapps\nuz\WEB-INF\lib\jstl-impl.jar], JarResourceLocation [jarPath=G:\Project.metadata.me_tcat7\webapps\nuz\WEB-INF\lib\log4j-1.2.16.jar], JarResourceLocation [jarPath=E:\programming software\MyEclipce\binary\com.sun.java.jdk.win32.x86_64_1.6.0.u43\lib\tools.jar], FileSystemResourceLocation [root=G:\Project.metadata.me_tcat7\webapps\nuz\WEB-INF\classes], FileSystemResourceLocation [root=E:\programming software\MyEclipce\plugins\com.genuitec.eclipse.easie.tomcat7.myeclipse_11.0.0.me201302261706\tomcat\bin], JarResourceLocation [jarPath=E:\programming software\MyEclipce\plugins\com.genuitec.eclipse.easie.tomcat7.myeclipse_11.0.0.me201302261706\tomcat\bin\tomcat-juli.jar], JarResourceLocation [jarPath=G:\Project.metadata.me_tcat7\webapps\nuz\WEB-INF\lib\druid-0.2.2.jar], JarResourceLocation [jarPath=G:\Project.metadata.me_tcat7\webapps\nuz\WEB-INF\lib\nutz-1.b.53.jar], JarResourceLocation [jarPath=E:\programming software\MyEclipce\plugins\com.genuitec.eclipse.easie.tomcat7.myeclipse_11.0.0.me201302261706\tomcat\bin\bootstrap.jar], JarResourceLocation [jarPath=G:\Project.metadata.me_tcat7\webapps\nuz\WEB-INF\lib\javax.servlet.jsp.jstl.jar], JarResourceLocation [jarPath=G:\Project.metadata.me_tcat7\webapps\nuz\WEB-INF\lib\mysql-connector-java-5.1.39-bin.jar]]
2016-08-29 02:43:42,766 [localhost-startStop-1] DEBUG org.nutz.mvc.config.AbstractNutConfig - MainModule: <com.parker.nutz.MainModule>
2016-08-29 02:43:42,787 [localhost-startStop-1] DEBUG org.nutz.mvc.config.AbstractNutConfig - Loading by class org.nutz.mvc.impl.NutLoading
2016-08-29 02:43:42,793 [localhost-startStop-1] INFO org.nutz.mvc.impl.NutLoading - Nutz Version : 1.b.53
2016-08-29 02:43:42,793 [localhost-startStop-1] INFO org.nutz.mvc.impl.NutLoading - Nutz.Mvc[nutz] is initializing ...
2016-08-29 02:43:42,793 [localhost-startStop-1] DEBUG org.nutz.mvc.impl.NutLoading - Web Container Information:
2016-08-29 02:43:42,795 [localhost-startStop-1] DEBUG org.nutz.mvc.impl.NutLoading - - Default Charset : GBK
2016-08-29 02:43:42,795 [localhost-startStop-1] DEBUG org.nutz.mvc.impl.NutLoading - - Current . path : E:\programming software\MyEclipce\plugins\com.genuitec.eclipse.easie.tomcat7.myeclipse_11.0.0.me201302261706\tomcat\bin.
2016-08-29 02:43:42,795 [localhost-startStop-1] DEBUG org.nutz.mvc.impl.NutLoading - - Java Version : 1.6.0_43
2016-08-29 02:43:42,795 [localhost-startStop-1] DEBUG org.nutz.mvc.impl.NutLoading - - File separator : \
2016-08-29 02:43:42,795 [localhost-startStop-1] DEBUG org.nutz.mvc.impl.NutLoading - - Timezone : Asia/Shanghai
2016-08-29 02:43:42,795 [localhost-startStop-1] DEBUG org.nutz.mvc.impl.NutLoading - - OS : Windows 8 amd64
2016-08-29 02:43:42,795 [localhost-startStop-1] DEBUG org.nutz.mvc.impl.NutLoading - - ServerInfo : Apache Tomcat/7.0.30
2016-08-29 02:43:42,795 [localhost-startStop-1] DEBUG org.nutz.mvc.impl.NutLoading - - Servlet API : 3.0
2016-08-29 02:43:42,795 [localhost-startStop-1] DEBUG org.nutz.mvc.impl.NutLoading - - ContextPath : /nuz
2016-08-29 02:43:42,797 [localhost-startStop-1] DEBUG org.nutz.mvc.config.AbstractNutConfig - MainModule: <com.parker.nutz.MainModule>
2016-08-29 02:43:42,797 [localhost-startStop-1] DEBUG org.nutz.mvc.impl.NutLoading - >> app.root = G:/Project/.metadata/.me_tcat7/webapps/nuz
2016-08-29 02:43:42,943 [localhost-startStop-1] DEBUG org.nutz.castor.Castors - Using 91 castor for Castors
2016-08-29 02:43:42,951 [localhost-startStop-1] DEBUG org.nutz.mvc.impl.NutLoading - @IocBy(type=org.nutz.mvc.ioc.provider.ComboIocProvider, args=["*org.nutz.ioc.loader.json.JsonLoader", "ioc/", "org.nutz.ioc.loader.annotation.AnnotationIocLoader", "com.parker.nutz", "*tx"],init=[])
2016-08-29 02:43:42,985 [localhost-startStop-1] DEBUG org.nutz.resource.Scans - Found 1 resource by src( ioc/ ) , regex( ^(.+[.])(js|json)$ )
2016-08-29 02:43:42,987 [localhost-startStop-1] DEBUG org.nutz.resource.Scans - Found 0 resource by src( org.nutz.ioc.loader.annotation.AnnotationIocLoader ) , regex( ^(.+[.])(js|json)$ )
2016-08-29 02:43:42,989 [localhost-startStop-1] DEBUG org.nutz.resource.Scans - Found 0 resource by src( com.parker.nutz ) , regex( ^(.+[.])(js|json)$ )
2016-08-29 02:43:42,989 [localhost-startStop-1] DEBUG org.nutz.ioc.loader.json.JsonLoader - loading ioc js config from [dao.js]
2016-08-29 02:43:42,999 [localhost-startStop-1] DEBUG org.nutz.ioc.loader.json.JsonLoader - Loaded 1 bean define from path=[ioc/, org.nutz.ioc.loader.annotation.AnnotationIocLoader, com.parker.nutz] --> [dataSource]
2016-08-29 02:43:43,003 [localhost-startStop-1] DEBUG org.nutz.ioc.loader.json.JsonLoader - Loaded 5 bean define from reader --
[txREPEATABLE_READ, txREAD_COMMITTED, txNONE, txSERIALIZABLE, txREAD_UNCOMMITTED]
2016-08-29 02:43:43,008 [localhost-startStop-1] INFO org.nutz.ioc.impl.NutIoc - NutIoc init begin ...
2016-08-29 02:43:43,013 [localhost-startStop-1] INFO org.nutz.ioc.impl.NutIoc - ... NutIoc init complete
2016-08-29 02:43:43,015 [localhost-startStop-1] DEBUG org.nutz.mvc.config.AbstractNutConfig - MainModule: <com.parker.nutz.MainModule>
2016-08-29 02:43:43,020 [localhost-startStop-1] INFO org.nutz.mvc.impl.NutLoading - Build URL mapping by org.nutz.mvc.impl.UrlMappingImpl ...
2016-08-29 02:43:43,024 [localhost-startStop-1] DEBUG org.nutz.mvc.impl.NutLoading - @Views(DefaultViewMaker)
2016-08-29 02:43:43,036 [localhost-startStop-1] DEBUG org.nutz.mvc.impl.NutLoading - @ChainBy(org.nutz.mvc.impl.NutActionChainMaker)
2016-08-29 02:43:43,048 [localhost-startStop-1] DEBUG org.nutz.mvc.impl.Loadings - module class location 'file:/G:/Project/.metadata/.me_tcat7/webapps/nuz/WEB-INF/classes/com/parker/nutz/MainModule.class'
2016-08-29 02:43:43,050 [localhost-startStop-1] DEBUG org.nutz.mvc.impl.Loadings - > scan 'com.parker.nutz'
2016-08-29 02:43:43,052 [localhost-startStop-1] DEBUG org.nutz.resource.Scans - Found 2 resource by src( com/parker/nutz/ ) , regex( ^.+[.]class$ )
2016-08-29 02:43:43,059 [localhost-startStop-1] DEBUG org.nutz.mvc.impl.Loadings - >> add 'com.parker.nutz.module.UserModule'
2016-08-29 02:43:43,075 [localhost-startStop-1] INFO org.nutz.mvc.impl.NutActionChainMaker - Optional processor class not found, disabled : org.nutz.integration.shiro.NutShiroProcessor
2016-08-29 02:43:43,084 [localhost-startStop-1] INFO org.nutz.mvc.impl.NutActionChainMaker - Optional processor class not found, disabled : org.nutz.plugins.validation.ValidationProcessor
2016-08-29 02:43:43,095 [localhost-startStop-1] DEBUG org.nutz.mvc.impl.UrlMappingImpl - '/ping' >> UserModule.ping(...) : Object | @Ok(json ) @Fail(json ) | by 0 Filters | (I:UTF-8/O:UTF-8)
2016-08-29 02:43:43,095 [localhost-startStop-1] INFO org.nutz.mvc.impl.NutLoading - Found 1 module methods
2016-08-29 02:43:43,097 [localhost-startStop-1] DEBUG org.nutz.mvc.impl.NutLoading - @Localization not define
2016-08-29 02:43:43,101 [localhost-startStop-1] INFO org.nutz.mvc.impl.NutLoading - Nutz.Mvc[nutz] is up in 304ms
2016-8-29 2:43:43 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]
2016-8-29 2:43:43 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-8009"]
2016-8-29 2:43:43 org.apache.catalina.startup.Catalina start
信息: Server startup in 1789 ms
2016-08-29 02:44:16,221 [http-bio-8080-exec-9] DEBUG org.nutz.mvc.impl.UrlMappingImpl - Found mapping for [GET] path=/ping : UserModule.ping(...)
2016-08-29 02:44:16,224 [http-bio-8080-exec-9] DEBUG org.nutz.ioc.impl.NutIoc - Get 'userModule'<class com.parker.nutz.module.UserModule>
2016-08-29 02:44:16,226 [http-bio-8080-exec-9] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition
2016-08-29 02:44:16,230 [http-bio-8080-exec-9] WARN org.nutz.mvc.impl.processor.FailProcessor - Error@/ping :
org.nutz.ioc.IocException: Object 'userModule' without define! For object [userModule] - type:[class com.parker.nutz.module.UserModule]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:203)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:221)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:106)
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:40)
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:183)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.nutz.ioc.ObjectLoadException: Object 'userModule' without define!
at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:149)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:168)
... 25 more
2016-08-29 02:44:18,876 [http-bio-8080-exec-9] DEBUG org.nutz.mvc.impl.UrlMappingImpl - Found mapping for [GET] path=/ping : UserModule.ping(...)
2016-08-29 02:44:18,877 [http-bio-8080-exec-9] DEBUG org.nutz.ioc.impl.NutIoc - Get 'userModule'<class com.parker.nutz.module.UserModule>
2016-08-29 02:44:18,877 [http-bio-8080-exec-9] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition
2016-08-29 02:44:18,877 [http-bio-8080-exec-9] WARN org.nutz.mvc.impl.processor.FailProcessor - Error@/ping :
org.nutz.ioc.IocException: Object 'userModule' without define! For object [userModule] - type:[class com.parker.nutz.module.UserModule]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:203)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:221)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:106)
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:40)
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:183)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.nutz.ioc.ObjectLoadException: Object 'userModule' without define!
at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:149)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:168)
... 25 more
2016-08-29 02:44:35,110 [http-bio-8080-exec-5] DEBUG org.nutz.mvc.impl.UrlMappingImpl - Found mapping for [GET] path=/ping : UserModule.ping(...)
2016-08-29 02:44:35,111 [http-bio-8080-exec-5] DEBUG org.nutz.ioc.impl.NutIoc - Get 'userModule'<class com.parker.nutz.module.UserModule>
2016-08-29 02:44:35,111 [http-bio-8080-exec-5] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition
2016-08-29 02:44:35,111 [http-bio-8080-exec-5] WARN org.nutz.mvc.impl.processor.FailProcessor - Error@/ping :
org.nutz.ioc.IocException: Object 'userModule' without define! For object [userModule] - type:[class com.parker.nutz.module.UserModule]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:203)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:221)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:106)
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:40)
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:183)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.nutz.ioc.ObjectLoadException: Object 'userModule' without define!
at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:149)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:168)
... 25 more

web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

nutz
org.nutz.mvc.NutFilter

modules
com.parker.nutz.MainModule



nutz
/*

一、dao.js
var ioc = {
dataSource : {
type : "com.alibaba.druid.pool.DruidDataSource",
fields : {
driverClassName : 'com.mysql.jdbc.Driver',
url : 'jdbc:mysql://localhost:3306/test',
username : 'root',
password : '1234'
},
dao : {
type : "org.nutz.dao.impl.NutDao",
args : [ {
refer : "dataSource"
} ]
}

}

};

二、MainModule.java
package com.parker.nutz;

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

@Modules(scanPackage=true)
@Ok("json")
@Fail("json")
@IocBy(type=ComboIocProvider.class,
args={"*org.nutz.ioc.loader.json.JsonLoader",
"ioc/",
"org.nutz.ioc.loader.annotation.AnnotationIocLoader",
"com.parker.nutz","*tx"})
public class MainModule {

}

三、UserModule.java
package com.parker.nutz.module;

import java.util.Date;

import org.nutz.dao.Dao;

import org.nutz.ioc.annotation.InjectName;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;

import org.nutz.mvc.annotation.At;

@IocBean
@InjectName("userModule")
public class UserModule {

@Inject
private Dao dao;

@At("/ping")
public Object ping() {

    return new Date();
}

}

请问大神,上面的情况怎么解决?麻烦一下了

org.nutz.ioc.loader.annotation.AnnotationIocLoader 前面少了星号

"*org.nutz.ioc.loader.annotation.AnnotationIocLoader"

来自炫酷的 NutzCN

2016-08-29 21:48:02,371 [http-bio-8080-exec-6] DEBUG org.nutz.mvc.impl.UrlMappingImpl - Found mapping for [GET] path=/ping : UserModule.ping(...)
2016-08-29 21:48:02,374 [http-bio-8080-exec-6] DEBUG org.nutz.ioc.impl.NutIoc - Get 'userModule'<class com.parker.nutz.module.UserModule>
2016-08-29 21:48:02,376 [http-bio-8080-exec-6] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition
2016-08-29 21:48:02,378 [http-bio-8080-exec-6] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(userModule) in IocLoader(AnnotationIocLoader@185087767)
2016-08-29 21:48:02,379 [http-bio-8080-exec-6] DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'userModule'<class com.parker.nutz.module.UserModule>
2016-08-29 21:48:02,386 [http-bio-8080-exec-6] DEBUG org.nutz.ioc.aop.impl.DefaultMirrorFactory - class com.parker.nutz.module.UserModule without AOP
2016-08-29 21:48:02,387 [http-bio-8080-exec-6] DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'userModule' to [app]
2016-08-29 21:48:02,404 [http-bio-8080-exec-6] DEBUG org.nutz.ioc.impl.NutIoc - Get 'dao'<>
2016-08-29 21:48:02,404 [http-bio-8080-exec-6] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition
2016-08-29 21:48:02,404 [http-bio-8080-exec-6] DEBUG org.nutz.ioc.impl.ScopeContext - Remove object 'userModule' from [app]
2016-08-29 21:48:02,407 [http-bio-8080-exec-6] WARN org.nutz.mvc.impl.processor.FailProcessor - Error@/ping :
org.nutz.ioc.IocException: Object 'dao' without define! For object [dao] - type:[] FAIL to create Ioc Bean name=[userModule]
beacase [Object 'dao' without define! For object [dao] - type:[]]
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:141)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:196)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:221)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:106)
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:40)
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:183)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.nutz.ioc.IocException: Object 'dao' without define! For object [dao] - type:[]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:203)
at org.nutz.ioc.val.ReferValue.get(ReferValue.java:24)
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:31)
at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:132)
... 26 more
Caused by: org.nutz.ioc.ObjectLoadException: Object 'dao' without define!
at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:149)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:168)
... 30 more

大神,改完之后又出现这个问题,咋办?

启动日志贴一下

dao.js写错了, 扫了括弧.

2016-08-29 02:43:42,999 [localhost-startStop-1] DEBUG org.nutz.ioc.loader.json.JsonLoader - Loaded 1 bean define from path=[ioc/, org.nutz.ioc.loader.annotation.AnnotationIocLoader, com.parker.nutz] --> [dataSource]

文件名是dao.js

var ioc = {
	dataSource : {
		type : "com.alibaba.druid.pool.DruidDataSource",
		fields : {
			driverClassName : 'com.mysql.jdbc.Driver',
			url : 'jdbc:mysql://localhost:3306/test',
			username : 'root',
			password : '1234'
		},
		dao : {
			type : "org.nutz.dao.impl.NutDao",
			args : [ {
				refer : "dataSource"
			} ]
		}

	}
};
var ioc = {
	dataSource : {
		type : "com.alibaba.druid.pool.DruidDataSource",
		fields : {
			driverClassName : 'com.mysql.jdbc.Driver',
			url : 'jdbc:mysql://localhost:3306/test',
			username : 'root',
			password : '1234'
		}
	},
	// dao与dataSource是平级的,你给写到dataSource里面去了
    dao : {
        type : "org.nutz.dao.impl.NutDao",
        args : [ {
            refer : "dataSource"
        } ]
    }
};

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