Jfinal3.1使用HikariCP连接池在tomcat启动不成功

jfinal3.1使用 HikariCpPlugin,在jetty下启动没有问题,但是在tomcat8.0下面启动不成功,报错信息如下:

java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
	at com.zaxxer.hikari.HikariConfig.<clinit>(HikariConfig.java:51)
	at com.jfinal.plugin.hikaricp.HikariCpPlugin.start(HikariCpPlugin.java:162)
	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.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: org.slf4j.LoggerFactory
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 22 more
29-Nov-2019 15:52:31.366 严重 [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more Filters failed to start. Full details will be found in the appropriate container log file
29-Nov-2019 15:52:31.367 严重 [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/hykm] startup failed due to previous errors

hykm是我的工程名字, slf4j的三个包我都导入了,这是我的pom.xml

<dependency>
   <groupId>org.slf4j</groupId>
   <artifactId>slf4j-api</artifactId>
   <version>1.7.13</version>
</dependency>
<dependency>
   <groupId>org.slf4j</groupId>
   <artifactId>slf4j-log4j12</artifactId>
   <version>1.7.13</version>
</dependency>
<dependency>
   <groupId>org.slf4j</groupId>
   <artifactId>slf4j-simple</artifactId>
   <version>1.7.13</version>
</dependency>
<dependency>
   <groupId>com.zaxxer</groupId>
   <artifactId>HikariCP</artifactId>
   <version>3.4.1</version>
</dependency>
<dependency>
   <groupId>com.jfinal</groupId>
   <artifactId>jfinal</artifactId>
   <version>3.1</version>
</dependency>

@JFinal,波哥,这是什么原因啊

评论区

JFinal

2019-11-29 16:26

NoClassDefFoundError: org/slf4j/LoggerFactory 这个异常已经是最基本的 java 知识了,要不是缺依赖,要不是多个不同版本的相同依赖产生影响

nommpop

2019-11-29 16:35

好的,我再看看,谢谢波哥

热门反馈

扫码入社