NutzCN Logo
问答 启动服务,报Wrong type name: 'com.alibaba.druid.pool.DruidDataSource'
发布于 2477天前 作者 xiaoganghub 1550 次浏览 复制 上一个帖子 下一个帖子
标签:

-----------日志-----------------------
18-03-12 22:11:07.380 DEBUG [localhost-startStop-1] Found 4 resource by src( com/gang/ ) , regex( ^.+[.]class$ )
18-03-12 22:11:07.392 DEBUG [localhost-startStop-1] >> add 'com.gang.module.UserModule'
18-03-12 22:11:07.393 DEBUG [localhost-startStop-1] Use org.nutz.mvc.impl.NutEntryDeterminer as EntryMethodDeterminer
18-03-12 22:11:07.424 WARN [localhost-startStop-1] Moudle with @InjectName('userModule') or @IocBean('userModule') but no such ioc bean found!! Pls check your ioc configure!!
18-03-12 22:11:07.426 INFO [localhost-startStop-1] Optional processor class not found, disabled : org.nutz.integration.shiro.NutShiroProcessor
18-03-12 22:11:07.450 INFO [localhost-startStop-1] Optional processor class not found, disabled : org.nutz.plugins.validation.ValidationProcessor
18-03-12 22:11:07.473 DEBUG [localhost-startStop-1] '/usr/ping' >> (UserModule.java:22).ping : Object | @Ok(json ) @Fail(json ) | by 0 Filters | (I:UTF-8/O:UTF-8)
18-03-12 22:11:07.473 INFO [localhost-startStop-1] Found 1 module methods
18-03-12 22:11:07.475 DEBUG [localhost-startStop-1] @Localization not define
18-03-12 22:11:07.476 INFO [localhost-startStop-1] Setup application...
18-03-12 22:11:07.509 DEBUG [localhost-startStop-1] config ioc =/*NutIoc*/
{
loader:/*ComboIocLoader*/
{
"paths": ["conf/ioc/"],
"map": {
"dataSource": {
"type": "com.alibaba.druid.pool.DruidDataSource",
"events": {
"create": "init",
"depose": "close"
},
"fields": {
"url": "jdbc:mysql://127.0.0.1:3306/nut",
"username": "root",
"password": "123456",
"testWhileIdle": true,
"validationQuery": "select 1",
"maxActive": 100
}
},
"dao": {
"type": "org.nutz.dao.impl.NutDao",
"args": [{
"refer": "dataSource"
}]
}
}

"map": {
},
"packages": ["com.gang.nutz"]

},
}
18-03-12 22:11:07.511 DEBUG [localhost-startStop-1] Get 'dao'<interface org.nutz.dao.Dao>
18-03-12 22:11:07.516 DEBUG [localhost-startStop-1] Load AopConfigure for anno=org.nutz.ioc.aop.Aop by type=org.nutz.ioc.aop.config.impl.AnnotationAopConfigration
18-03-12 22:11:07.518 DEBUG [localhost-startStop-1] >> Load definition name=dao
18-03-12 22:11:07.530 DEBUG [localhost-startStop-1] Found IocObject(dao) in JsonLoader(paths=[conf/ioc/])
18-03-12 22:11:07.530 DEBUG [localhost-startStop-1] >> Make...'dao'<interface org.nutz.dao.Dao>
18-03-12 22:11:07.535 DEBUG [localhost-startStop-1] Save object 'dao' to [app]
18-03-12 22:11:07.538 DEBUG [localhost-startStop-1] Get 'dataSource'<>
18-03-12 22:11:07.538 DEBUG [localhost-startStop-1] >> Load definition name=dataSource
18-03-12 22:11:07.541 DEBUG [localhost-startStop-1] Remove object 'dao' from [app]
18-03-12 22:11:07.541 ERROR [localhost-startStop-1] Error happend during start serivce!
org.nutz.ioc.IocException: IocBean[dao -> dataSource] For object [dataSource] - type:[]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:249)
at org.nutz.ioc.val.ReferValue.get(ReferValue.java:24)
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:64)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:240)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:270)

at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:160)
at com.gang.GangSetup.init(GangSetup.java:19)
at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:278)
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:285)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4599)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5241)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1141)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

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:55)
at org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:80)
at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:152)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:194)

... 27 more

Caused by: java.lang.ClassNotFoundException: com.alibaba.druid.pool.DruidDataSource

at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1291)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.nutz.lang.Lang.loadClass(Lang.java:2074)
at org.nutz.ioc.IocLoading.map2iobj(IocLoading.java:51)
... 30 more

18-03-12 22:11:07.544 ERROR [localhost-startStop-1] try to depose ioc
18-03-12 22:11:07.545 INFO [localhost-startStop-1] org.nutz.ioc.impl.NutIoc@1243873450 is closing. startup date [18-03-12 22:11:07.330]
18-03-12 22:11:07.545 INFO [localhost-startStop-1] org.nutz.ioc.impl.NutIoc@1243873450 is deposed. startup date [18-03-12 22:11:07.330]
三月 12, 2018 10:11:07 下午 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter [nutz]
org.nutz.mvc.LoadingException: org.nutz.ioc.IocException: IocBean[dao -> dataSource] For object [dataSource] - type:[]
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:1010)
at org.nutz.lang.Lang.wrapThrow(Lang.java:201)
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:91)
at org.nutz.mvc.NutFilter.init(NutFilter.java:69)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4599)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5241)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1141)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.nutz.ioc.IocException: IocBean[dao -> dataSource] For object [dataSource] - type:[]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:249)
at org.nutz.ioc.val.ReferValue.get(ReferValue.java:24)
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:64)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:240)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:270)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:160)
at com.gang.GangSetup.init(GangSetup.java:19)
at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:278)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:121)
... 19 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:55)
at org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:80)
at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:152)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:194)
... 27 more
Caused by: java.lang.ClassNotFoundException: com.alibaba.druid.pool.DruidDataSource
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1291)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.nutz.lang.Lang.loadClass(Lang.java:2074)
at org.nutz.ioc.IocLoading.map2iobj(IocLoading.java:51)
... 30 more

--------MainModule-----
@SetupBy(value=GangSetup.class)
public class MainModule

public class GangSetup implements Setup{

private static final Log log = Logs.get();

public void init(NutConfig config) {
    log.debug("config ioc =" + config.getIoc());
    Dao dao = config.getIoc().get(Dao.class);
    for (Class<?> klass : Scans.me().scanPackage("com.gang.nutz")) {
       if (null != klass.getAnnotation(Table.class)) {
         dao.create(klass,false);
       }

       if (dao.count(User.class) == 0) {
         User admin = new User();
         admin.setName("admin");
         admin.setName("123456");
         dao.insert(admin);
       }
    }
}

----------dao.js-------------
var ioc = {
dataSource : {
type : "com.alibaba.druid.pool.DruidDataSource",
events : {
create : "init",
depose : 'close'
},
fields : {
url : "jdbc:mysql://127.0.0.1:3306/nut",
username : "root",
password : "123456",
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"}]
}
};

2 回复
Caused by: java.lang.ClassNotFoundException: com.alibaba.druid.pool.DruidDataSource

缺druid的jar

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