Jfinal-weixin配置连接池报错

DruidPlugin mysqlPool = new DruidPlugin(PropKit.get("jdbcUrl"),PropKit.get("user"),PropKit.get("password"));

        me.add(mysqlPool);

        ActiveRecordPlugin arpMysql = new ActiveRecordPlugin("mysql", mysqlPool);

        me.add(arpMysql);

        arpMysql.addMapping("msg_news", "id",MsgNews.class);

以上是在configPlugin中配置的连接,启动项目时就直接报错。

2017-07-03 14:05:44.310:WARN:oejuc.AbstractLifeCycle:FAILED jfinal: java.lang.NoClassDefFoundError: com/alibaba/druid/pool/DruidDataSource

java.lang.NoClassDefFoundError: com/alibaba/druid/pool/DruidDataSource

at com.jfinal.plugin.druid.DruidPlugin.start(DruidPlugin.java:180)

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

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

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

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

at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)

at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)

at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)

at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)

at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)

at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)

at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)

at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)

at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)

at org.eclipse.jetty.server.Server.doStart(Server.java:277)

at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)

at com.jfinal.server.JettyServer.doStart(JettyServer.java:131)

at com.jfinal.server.JettyServer.start(JettyServer.java:70)

at com.jfinal.core.JFinal.start(JFinal.java:159)

at com.jfinal.weixin.demo.WeixinConfig.main(WeixinConfig.java:141)

Caused by: 

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

at java.net.URLClassLoader$1.run(Unknown Source)

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:430)

at com.jfinal.server.JFinalClassLoader.loadClass(JFinalClassLoader.java:53)

at com.jfinal.plugin.druid.DruidPlugin.start(DruidPlugin.java:180)

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

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

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

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

at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)

at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)

at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)

at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)

at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)

at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)

at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)

at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)

at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)

at org.eclipse.jetty.server.Server.doStart(Server.java:277)

at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)

at com.jfinal.server.JettyServer.doStart(JettyServer.java:131)

at com.jfinal.server.JettyServer.start(JettyServer.java:70)

at com.jfinal.core.JFinal.start(JFinal.java:159)

at com.jfinal.weixin.demo.WeixinConfig.main(WeixinConfig.java:141)

以上就是错误信息,如果不添加连接池是可以启动的,不知道有没有人和我一样。希望有大神指点一下。

评论区

Chenag

2017-07-03 14:19

JFinal

2017-07-03 22:06

缺少 druid 的 jar 包, class not found 是 java 基础

jf_henry

2018-01-19 14:45

在pom.xml中已经配置了druid的jar包,运行一样报错呢

Heshuhao

2018-06-22 15:53

同一个错,配置了druid的jar包,运行一样报错

热门反馈

扫码入社