NutzCN Logo
问答 请问dao.js里面 dao中的type是什么意思?
发布于 2894天前 作者 qq_152b6ff2 2363 次浏览 复制 上一个帖子 下一个帖子
标签:

下面的type和args代表了什么?

dao : {
            type : "org.nutz.dao.impl.NutDao",
            args : [{refer:"dataSource"}]
        }
29 回复

type是类名,args是构造方法的参数列表

@wendal 但是我没有找到org.nutz.dao.impl.NutDao 这个类呀,这写法是固定的么?

@wendal 还有请问一下里面这些参数都代表什么呀 如果我的MainModule在net.nutz目录下,是这样写没有错么?

@IocBy(type=ComboIocProvider.class, args={"*js", "ioc/",
                                           "*anno", "net.nutz",
                                           "*tx", // 事务拦截 aop
                                           "*async"})

@qq_152b6ff2 没有找到这个类?用的是什么jar?

那是ioc js的格式要求,type/args对应的值都可以变

@wendal = =原来是jar自带的阿。

@wendal 请问为什么找不到ioc呀,我配置的没有错呀。。

org.nutz.lang.born.BorningException: Fail to born 'org.nutz.ioc.loader.json.JsonLoader'
 by args: [
  @(ioc/)] becasue:
java.lang.RuntimeException: folder or file like '^(.+[.])(js|json)$' no found in ioc/
	at org.nutz.lang.born.DynamicConstructorBorning.born(DynamicConstructorBorning.java:21)
	at org.nutz.lang.born.BornContext.doBorn(BornContext.java:60)
	at org.nutz.lang.Mirror.born(Mirror.java:990)
	at org.nutz.ioc.loader.combo.ComboIocLoader.createIocLoader(ComboIocLoader.java:126)
	at org.nutz.ioc.loader.combo.ComboIocLoader.<init>(ComboIocLoader.java:80)
	at org.nutz.mvc.ioc.provider.ComboIocProvider.create(ComboIocProvider.java:20)
	at org.nutz.mvc.impl.NutLoading.createIoc(NutLoading.java:384)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:103)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:87)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3800)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4450)
	at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3190)
	at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:404)
	at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1309)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
	at java.lang.Thread.run(Thread.java:619)

你的ioc目录的全路径是什么

@wendal 怎么看全路径= =我就放在conf文件夹下面的ioc里呀

@qq_152b6ff2 是不是conf目录没设置为源文件夹

@wendal conf目录是后面添加进去的。。

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

如果是后面补的, 右键conf文件夹, build path, as source folder.

@wendal 伽利略版的eclipse= =没有build path啊

@wendal 我删了重新建就好啦。还有请问add update insert query 里面测试方法是什么意思呀 @param()里面的参数是啥?

@wendal 最新问题=-=在自动建表的时候报这个错误

16-12-20 11:21:35.60 DEBUG [main] Table 'project' doesn't exist!
16-12-20 11:21:35.78 DEBUG [main] SELECT COUNT(*) FROM project 
16-12-20 11:21:35.91 DEBUG [main] SQLException
java.sql.SQLSyntaxErrorException: ORA-00942: ¿¿¿¿¿¿¿

	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439)
	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:395)
	at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:802)
	at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436)
	at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)
	at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:521)
	at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:194)
	at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:853)
	at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1145)
	at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1267)
	at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1469)
	at oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:389)
	at com.alibaba.druid.pool.DruidPooledStatement.executeQuery(DruidPooledStatement.java:138)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor._runSelect(NutDaoExecutor.java:246)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:53)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
	at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
	at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:147)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithoutTransaction(NutDaoRunner.java:114)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:81)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:70)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:266)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:274)
	at org.nutz.dao.impl.NutDao.func(NutDao.java:741)
	at org.nutz.dao.impl.NutDao.func(NutDao.java:722)
	at org.nutz.dao.impl.NutDao._count(NutDao.java:709)
	at org.nutz.dao.impl.NutDao.count(NutDao.java:671)
	at org.nutz.project.mvc.MainSetup.init(MainSetup.java:21)
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:277)
	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:87)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3800)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4450)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
16-12-20 11:21:35.93 ERROR [main] Error happend during start serivce!
org.nutz.dao.DaoException: !Nutz SQL Error: 'SELECT COUNT(*) FROM project '
PreparedStatement: 
'SELECT COUNT(*) FROM project '
CaseMessage=ORA-00942: ¿¿¿¿¿¿¿

前面建表的语句没写对,是不是pojo的package又写错了

@wendal 弄好了 有点尴尬= =不是很懂又弄错了,写到Mainmodule的路径去了

按nutzbook里面的结构很方便的

@wendal UserModule报错 = =我的UserModule在下面、、

16-12-20 13:46:28.722 DEBUG [http-8080-2] Search mapping for path=/project/count : NOT Action match
package org.nutz.project.service;

import javax.servlet.http.HttpSession;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.QueryResult;
import org.nutz.dao.pager.Pager;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Attr;
import org.nutz.mvc.annotation.Fail;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.project.bean.Project;

@IocBean
@At("/project")
@Ok("json")
@Fail("http:500")
public class UserModule {

    @Inject
    protected Dao dao;
    
    //返回project数量
    @At
    public int count() {
        return dao.count(Project.class);
    }
    
    
}

不按nutzbook里面的package结构,是需要多配置些东西的

@Modules(packages="xxx.xx.xxx", scanPackage=true)

@wendal 请问xxx那个填写说明=-=

@qq_152b6ff2 module类所在的package

@wendal = =又报500了。。好痛苦

@wendal 你好 为什么在控制台可以看到的是正常显示 但是在数据库里面显示会乱码呢?

16-12-20 14:25:49.617 DEBUG [main] INSERT INTO t_project(pid,pname,sqdw,sxmc) VALUES(?,?,?,?) 
    | 1 |         2 |    3 |         4 |
    |---|-----------|------|-----------|
    | 1 | 绿地卢湾CBD项目 | 绿地集团 | 建设项目选址意见书 |

@qq_152b6ff2 一般是是因为数据库本身不是utf-8

启动日志里面有显示mysql的编码信息

可通过修改jdbcurl或mysql的my.ini修正

@wendal 请问nutz怎么配置charset,在dao.js中配置吗?

@qq_152b6ff2 dao.js里jdbcurl

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