NutzCN Logo
问答 心热学习nutz遇到Dao.class报错
发布于 2800天前 作者 qq_216748c8 2049 次浏览 复制 上一个帖子 下一个帖子
标签:
17-04-24 11:56:27.078 ERROR [localhost-startStop-1] Error happend during start serivce!
org.nutz.dao.DaoException: Need non-arg constructor : interface org.nutz.dao.Dao
17-04-24 11:56:27.078 INFO [localhost-startStop-1] org.nutz.ioc.impl.NutIoc@53927869 is closing. startup date [17-04-24 11:56:25.750]
17-04-24 11:56:27.079 DEBUG [localhost-startStop-1] Depose object 'dao' ...
	at org.nutz.dao.impl.entity.NutEntity.<init>(NutEntity.java:190)
	at org.nutz.dao.impl.entity.AnnotationEntityMaker._createNutEntity(AnnotationEntityMaker.java:584)
	at org.nutz.dao.impl.entity.AnnotationEntityMaker.make(AnnotationEntityMaker.java:90)
	at org.nutz.dao.impl.EntityHolder.getEntity(EntityHolder.java:75)
	at org.nutz.dao.impl.NutDao.count(NutDao.java:647)
	at net.wendal.nutzbook.MainSetup.init(MainSetup.java:22)
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:274)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:121)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:91)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:69)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4583)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
17-04-24 11:56:27.078 ERROR [localhost-startStop-1] try to depose ioc
17-04-24 11:56:27.079 DEBUG [localhost-startStop-1] Depose object '$aop_async' ...
17-04-24 11:56:27.079 DEBUG [localhost-startStop-1] Depose object 'dataSource' ...
四月 24, 2017 11:56:27 上午 com.alibaba.druid.pool.DruidDataSource info
信息: {dataSource-1} closed
17-04-24 11:56:27.084 INFO [localhost-startStop-1] org.nutz.ioc.impl.NutIoc@53927869 is deposed. startup date [17-04-24 11:56:25.750]
四月 24, 2017 11:56:27 上午 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter nutz
org.nutz.mvc.LoadingException: org.nutz.dao.DaoException: Need non-arg constructor : interface org.nutz.dao.Dao
	at org.nutz.mvc.LoadingException$FC$9a86caf9ff5d3b587784fcdf555a4a7d.invoke(LoadingException.java)
	at org.nutz.lang.born.AbstractConstructorBorning.call(AbstractConstructorBorning.java:25)
	at org.nutz.lang.born.ConstructorBorning.born(ConstructorBorning.java:19)
	at org.nutz.lang.born.BornContext.doBorn(BornContext.java:60)
	at org.nutz.lang.Mirror.born(Mirror.java:990)
	at org.nutz.lang.Lang.wrapThrow(Lang.java:200)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:135)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:91)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:69)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4583)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.nutz.dao.DaoException: Need non-arg constructor : interface org.nutz.dao.Dao
	at org.nutz.dao.impl.entity.NutEntity.<init>(NutEntity.java:190)
	at org.nutz.dao.impl.entity.AnnotationEntityMaker._createNutEntity(AnnotationEntityMaker.java:584)
	at org.nutz.dao.impl.entity.AnnotationEntityMaker.make(AnnotationEntityMaker.java:90)
	at org.nutz.dao.impl.EntityHolder.getEntity(EntityHolder.java:75)
	at org.nutz.dao.impl.NutDao.count(NutDao.java:647)
	at net.wendal.nutzbook.MainSetup.init(MainSetup.java:22)
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:274)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:121)
	... 15 more

5 回复

dao.js写错了,贴出来看看

按照官方手册搭建的,maven,基于最新版本的nutz

var ioc = {
        dataSource : {
            type : "com.alibaba.druid.pool.DruidDataSource",
            events : {
                create : "init",
                depose : 'close'
            },
            fields : {
                url : "jdbc:mysql://127.0.0.1:3307/nutzbook",
                username : "root",
                password : "root",
                testWhileIdle : true, // 非常重要,预防mysql的8小时timeout问题
                validationQuery : "select 1" , // Oracle的话需要改成 select 1 from dual
                maxActive : 100
            }
        },
        dao : {
            type : "org.nutz.dao.impl.NutDao",
            args : [{refer:"dataSource"}]
        }
};
at net.wendal.nutzbook.MainSetup.init(MainSetup.java:22)

这个代码贴来看看

谢谢作者,已经找到问题所在了,感谢指引!错把if (dao.count(User.class) == 0) 写成了Dao.class,已改正!祝nutz越来越好

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