配置数据库报NoClassDefFoundError咋回事啊

10-Oct-2019 09:49:50.246 严重 [localhost-startStop-1] org.apache.catalina.core.StandardContext.filterStart Exception starting filter [jfinal]

 java.lang.NoClassDefFoundError: com/mchange/v2/c3p0/ComboPooledDataSource

at com.jfinal.plugin.c3p0.C3p0Plugin.start(C3p0Plugin.java:150)

at com.jfinal.core.Config.startPlugins(Config.java:128)

at com.jfinal.core.Config.configPluginWithOrder(Config.java:71)

at com.jfinal.core.Config.configJFinal(Config.java:59)

at com.jfinal.core.JFinal.init(JFinal.java:61)

at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:63)

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:4637)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5282)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)

at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:985)

at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)

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: java.lang.ClassNotFoundException: com.mchange.v2.c3p0.ComboPooledDataSource

at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1309)

at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1137)

... 22 more



就是正常的配置呀

(Plugins me) {
     C3p0Plugin = C3p0Plugin(PropKit.()PropKit.()PropKit.().trim())me.add()ActiveRecordPlugin = ActiveRecordPlugin().addMapping(User.)me.add()}

求解,谢谢

评论区

2019-10-10 10:02

public void configPlugin(Plugins me) {
//配置C3p0数据库连接池插件
C3p0Plugin c3p0Plugin = new C3p0Plugin(PropKit.get("jdbcUrl"), PropKit.get("user"), PropKit.get("password").trim());
me.add(c3p0Plugin);
// 配置ActiveRecord插件
ActiveRecordPlugin arp = new ActiveRecordPlugin(c3p0Plugin);

arp.addMapping("user", User.class);
me.add(arp);
}

xiuj

2019-10-10 15:02

依赖包没有引用。

JFinal

2019-10-10 15:05

缺少 c3p0 依赖,不建议使用 c3p0 , 改用 DruidPlugin, 下载首页的 demo ,里面有实例

热门反馈

扫码入社