NutzCN Logo
问答 最新版的nutz框架,数据连接池使用c3p0,它的那些基本配置有没有跟其他类型的数据连接池有不一样的
发布于 2767天前 作者 t 2013 次浏览 复制 上一个帖子 下一个帖子
标签:

最新版的nutz框架,数据连接池使用c3p0,它的那些基本配置有没有跟其他类型的数据连接池有一点点变化

var ioc = {
dataSource : {
type:"com.mchange.v2.c3p0.ComboPooledDataSource",
events : {
create : "init",
depose : 'close'
},
fields : {
url : "jdbc:mysql://192.168.1.2:3306/test?useUnicode=true&characterEncoding=utf-8",
username : "root",
password : "root",
testWhileIdle : true, // 非常重要,预防mysql的8小时timeout问题
validationQuery : "select 1" , // Oracle的话需要改成 select 1 from dual
maxPoolsize : 20
}
},
dao : {
type : "org.nutz.dao.impl.NutDao",
args : [{refer:"dataSource"}]
}
};

这样子配置然后会发生这种情况,我怀疑我配错了,求解
org.nutz.mvc.LoadingException: org.nutz.ioc.IocException: [dao, dataSource] # FAIL to create Ioc Bean name=[dataSource]

5 回复

@wendal
严重: Exception starting filter nutz
org.nutz.mvc.LoadingException: org.nutz.ioc.IocException: [dao, dataSource] # FAIL to create Ioc Bean name=[dataSource]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.nutz.lang.born.ConstructorBorning.born(ConstructorBorning.java:17)
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:197)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:135)
at org.nutz.mvc.ActionHandler.(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:295)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:424)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4076)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4730)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
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:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.nutz.ioc.IocException: [dao, dataSource] # FAIL to create Ioc Bean name=[dataSource]
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:149)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:210)
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.impl.NutIoc.get(NutIoc.java:239)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:146)
at com.risun.nutzbook.MainSetup.init(MainSetup.java:22)
at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:277)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:121)
... 30 more
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: Fail to find Method com.mchange.v2.c3p0.ComboPooledDataSource->init with params:
[]
at org.nutz.lang.Lang.wrapThrow(Lang.java:181)
at org.nutz.ioc.impl.ObjectMakerImpl.createTrigger(ObjectMakerImpl.java:174)
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:62)
... 39 more
Caused by: java.lang.NoSuchMethodException: Fail to find Method com.mchange.v2.c3p0.ComboPooledDataSource->init with params:
[]
at org.nutz.lang.Mirror.findMethod(Mirror.java:1159)
at org.nutz.ioc.impl.ObjectMakerImpl.createTrigger(ObjectMakerImpl.java:171)
... 40 more
2017-5-26 17:22:17 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2017-5-26 17:22:17 org.apache.catalina.core.StandardContext start
严重: Context [/nutzbook] startup failed due to previous errors
2017-5-26 17:22:17 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory ROOT
2017-5-26 17:22:17 org.apache.coyote.http11.Http11AprProtocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2017-5-26 17:22:17 org.apache.coyote.ajp.AjpAprProtocol start
信息: Starting Coyote AJP/1.3 on ajp-8009
2017-5-26 17:22:17 org.apache.catalina.startup.Catalina start
信息: Server startup in 1657 ms

@wendal 我是初学者,感觉自己废了

events : {
 create : "init", // 把这一行去掉, ComboPooledDataSource并没有init方法
 depose : 'close'
 },
添加回复
请先登陆
回到顶部