启动报找不到userManager- -
-----------MainModule-------------
@Modules(scanPackage = true, packages = "cn.com.haoke.nutzhaoke.modules")
@IocBy(type = ComboIocProvider.class,
args = {"*js",
"ioc",
"*anno",
"cn.com.haoke.nutzhaoke.modules",
"*tx",
"*async"})
@SetupBy(MainSetup.class)
@ChainBy(args = {"chain"})
public class MainModule {
}
------------userAction-------------
package cn.com.haoke.nutzhaoke.modules.action;
import cn.com.haoke.nutzhaoke.modules.entity.User;
import cn.com.haoke.nutzhaoke.modules.services.UserManager;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.GET;
import org.nutz.mvc.annotation.Ok;
/**
* Created by Administrator on 2017/4/30.
* 用户
*/
@IocBean
@At("user")
public class UserAction {
@Inject
public UserManager userManager;
/**
* 注册
* @param accountNo 帐号
* */
@At
@Ok("json")
@GET
public Object register(String accountNo,String password,String code,String platform){
User user=new User(accountNo,password,code,platform);
Object resultObjet=userManager.rigster(user);
return null;
}
}
--------------UserManager----------------------
public interface UserManager{
Object rigster(User user);
}
--------------UserManagerImpl-----------------------
@IocBean
public class UserManagerImpl implements UserManager {
@Inject
public UserDao userDao;
@Override
public Object rigster(User user) {
User saveUser=userDao.rigster(user);
return null;
}
}
----------------------------------下面是日志信息-------------------
2017-04-30 17:38:31,385 [http-nio-8081-exec-4] DEBUG org.nutz.mvc.impl.UrlMappingImpl - Found mapping for [GET] path=/user/register : UserAction.register(UserAction.java:30)
2017-04-30 17:38:31,387 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.NutIoc - Get 'userAction'<class cn.com.haoke.nutzhaoke.modules.action.UserAction>
2017-04-30 17:38:31,388 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=userAction
2017-04-30 17:38:31,388 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(userAction) in AnnotationIocLoader(packages=[cn.com.haoke.nutzhaoke.modules])
2017-04-30 17:38:31,388 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'userAction'<class cn.com.haoke.nutzhaoke.modules.action.UserAction>
2017-04-30 17:38:31,389 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.aop.impl.DefaultMirrorFactory - Load class cn.com.haoke.nutzhaoke.modules.action.UserAction without AOP
2017-04-30 17:38:31,389 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'userAction' to [app]
2017-04-30 17:38:31,396 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.val.ReferTypeValue - name=userManager not found, search for type=cn.com.haoke.nutzhaoke.modules.services.UserManager
2017-04-30 17:38:31,396 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.map.MapLoader - Loading define for name=dataSource
2017-04-30 17:38:31,397 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.map.MapLoader - Loading define for name=conf
2017-04-30 17:38:31,397 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(conf) in JsonLoader(paths=[ioc])
2017-04-30 17:38:31,398 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.map.MapLoader - Loading define for name=dao
2017-04-30 17:38:31,400 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(dao) in JsonLoader(paths=[ioc])
2017-04-30 17:38:31,400 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(userManagerImpl) in AnnotationIocLoader(packages=[cn.com.haoke.nutzhaoke.modules])
2017-04-30 17:38:31,400 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.NutIoc - Get 'userManagerImpl'<interface cn.com.haoke.nutzhaoke.modules.services.UserManager>
2017-04-30 17:38:31,400 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=userManagerImpl
2017-04-30 17:38:31,400 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(userManagerImpl) in AnnotationIocLoader(packages=[cn.com.haoke.nutzhaoke.modules])
2017-04-30 17:38:31,400 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'userManagerImpl'<interface cn.com.haoke.nutzhaoke.modules.services.UserManager>
2017-04-30 17:38:31,400 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.aop.impl.DefaultMirrorFactory - Load class cn.com.haoke.nutzhaoke.modules.services.impl.UserManagerImpl without AOP
2017-04-30 17:38:31,400 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'userManagerImpl' to [app]
2017-04-30 17:38:31,402 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.val.ReferTypeValue - name=userDao not found, search for type=cn.com.haoke.nutzhaoke.modules.dao.UserDao
2017-04-30 17:38:31,402 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.map.MapLoader - Loading define for name=dataSource
2017-04-30 17:38:31,402 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.map.MapLoader - Loading define for name=conf
2017-04-30 17:38:31,403 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(conf) in JsonLoader(paths=[ioc])
2017-04-30 17:38:31,403 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.map.MapLoader - Loading define for name=dao
2017-04-30 17:38:31,403 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(dao) in JsonLoader(paths=[ioc])
2017-04-30 17:38:31,403 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(userManagerImpl) in AnnotationIocLoader(packages=[cn.com.haoke.nutzhaoke.modules])
2017-04-30 17:38:31,403 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(userAction) in AnnotationIocLoader(packages=[cn.com.haoke.nutzhaoke.modules])
2017-04-30 17:38:31,403 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(userDaoImpl) in AnnotationIocLoader(packages=[cn.com.haoke.nutzhaoke.modules])
2017-04-30 17:38:31,403 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.NutIoc - Get 'userDaoImpl'<interface cn.com.haoke.nutzhaoke.modules.dao.UserDao>
2017-04-30 17:38:31,403 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=userDaoImpl
2017-04-30 17:38:31,403 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(userDaoImpl) in AnnotationIocLoader(packages=[cn.com.haoke.nutzhaoke.modules])
2017-04-30 17:38:31,403 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'userDaoImpl'<interface cn.com.haoke.nutzhaoke.modules.dao.UserDao>
2017-04-30 17:38:31,403 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.aop.impl.DefaultMirrorFactory - Load class cn.com.haoke.nutzhaoke.modules.dao.impl.UserDaoImpl without AOP
2017-04-30 17:38:31,403 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'userDaoImpl' to [app]
2017-04-30 17:38:31,405 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.NutIoc - Get 'dao'<interface org.nutz.dao.Dao>
2017-04-30 17:38:31,405 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=dao
2017-04-30 17:38:31,405 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.map.MapLoader - Loading define for name=dao
2017-04-30 17:38:31,405 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(dao) in JsonLoader(paths=[ioc])
2017-04-30 17:38:31,405 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'dao'<interface org.nutz.dao.Dao>
2017-04-30 17:38:31,417 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.aop.impl.DefaultMirrorFactory - Load class org.nutz.dao.impl.NutDao without AOP
2017-04-30 17:38:31,417 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'dao' to [app]
2017-04-30 17:38:31,418 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.NutIoc - Get 'dataSource'<>
2017-04-30 17:38:31,418 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=dataSource
2017-04-30 17:38:31,418 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.loader.map.MapLoader - Loading define for name=dataSource
2017-04-30 17:38:31,418 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.ScopeContext - Remove object 'dao' from [app]
2017-04-30 17:38:31,418 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.ScopeContext - Remove object 'userDaoImpl' from [app]
2017-04-30 17:38:31,419 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.ScopeContext - Remove object 'userManagerImpl' from [app]
2017-04-30 17:38:31,419 [http-nio-8081-exec-4] DEBUG org.nutz.ioc.impl.ScopeContext - Remove object 'userAction' from [app]
2017-04-30 17:38:31,419 [http-nio-8081-exec-4] WARN org.nutz.mvc.impl.processor.FailProcessor - Error@/user/register :
org.nutz.ioc.IocException: IocBean[userAction] 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.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:110)
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:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
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[userAction] fail at field=[userManager]
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[userManagerImpl] 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.getByType(NutIoc.java:395)
at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:66)
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
... 31 more
Caused by: java.lang.RuntimeException: IocBean[userManagerImpl] fail at field=[userDao]
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)
... 35 more
Caused by: org.nutz.ioc.IocException: IocBean[userDaoImpl] 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.getByType(NutIoc.java:395)
at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:66)
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
... 37 more
Caused by: java.lang.RuntimeException: IocBean[userDaoImpl] fail at field=[dao]
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)
... 41 more
Caused by: org.nutz.ioc.IocException: IocBean[dao -> dataSource] For object [dataSource] - 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.val.ReferTypeValue.get(ReferTypeValue.java:60)
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
... 43 more
Caused by: org.nutz.ioc.ObjectLoadException: Wrong type name: 'com.alibaba.druid.pool.DruidDataSource'
at org.nutz.ioc.IocLoading.E(IocLoading.java:32)
at org.nutz.ioc.IocLoading.map2iobj(IocLoading.java:59)
at org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:86)
at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:147)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:180)
... 48 more
Caused by: java.lang.ClassNotFoundException: com.alibaba.druid.pool.DruidDataSource
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1275)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1109)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.nutz.lang.Lang.loadClass(Lang.java:2027)
at org.nutz.ioc.IocLoading.map2iobj(IocLoading.java:55)
... 51 more