java.lang.NoClassDefFoundError: com/jfinal/log/ILoggerFactory

myeclipse:启动正常, ROOT.war 部署到tomcat 报错,pom如下

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>


  <groupId>cmscrontab</groupId>

  <artifactId>cmscrontab</artifactId>

  <version>1.0</version>

  <packaging>war</packaging>


  <name>cmscrontab</name>

  <url>http://maven.apache.org</url>


  <properties>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <maven.compiler.encoding>UTF-8</maven.compiler.encoding>

  </properties>

  

  <!-- 使用阿里 maven 库 -->

  <repositories>

<repository>

<id>ali-maven</id>

<url>http://maven.aliyun.com/nexus/content/groups/public</url>

<releases>

<enabled>true</enabled>

</releases>

<snapshots>

<enabled>true</enabled>

<updatePolicy>always</updatePolicy>

<checksumPolicy>fail</checksumPolicy>

</snapshots>

</repository>

  </repositories>


  <dependencies>


<dependency>

<groupId>com.jfinal</groupId>

<artifactId>jetty-server</artifactId>

<version>8.1.8</version>

<!-- 此处的 scope 值为 compile 仅为支持 IDEA 下启动项目 打 war 包时需要改成 provided,以免将一些无用的 

jar 打进去 -->

<scope>provided</scope>

</dependency>


<dependency>

<groupId>com.jfinal</groupId>

<artifactId>jfinal</artifactId>

<version>3.3</version>

</dependency>


<dependency>

<groupId>log4j</groupId>

<artifactId>log4j</artifactId>

<version>1.2.17</version>

</dependency>


<dependency>

<groupId>net.bull.javamelody</groupId>

<artifactId>javamelody-core</artifactId>

<version>1.73.1</version>

</dependency>


<dependency>

<groupId>org.jrobin</groupId>

<artifactId>jrobin</artifactId>

<version>1.5.9</version>

</dependency>


<dependency>

<groupId>com.alibaba</groupId>

<artifactId>fastjson</artifactId>

<version>1.2.47</version>

</dependency>


<dependency>

<groupId>com.jfinal</groupId>

<artifactId>cos</artifactId>

<version>2017.5</version>

</dependency>


<dependency>

<groupId>javax.servlet</groupId>

<artifactId>jstl</artifactId>

<version>1.2</version>

<scope>provided</scope>

</dependency>


<dependency>

<groupId>javax.servlet.jsp</groupId>

<artifactId>jsp-api</artifactId>

<version>2.1</version>

<scope>provided</scope>

</dependency>


<dependency>

<groupId>commons-configuration</groupId>

<artifactId>commons-configuration</artifactId>

<version>1.10</version>

</dependency>


<dependency>

<groupId>commons-dbutils</groupId>

<artifactId>commons-dbutils</artifactId>

<version>1.7</version>

</dependency>


<dependency>

<groupId>commons-io</groupId>

<artifactId>commons-io</artifactId>

<version>2.6</version>

</dependency>


<dependency>

<groupId>commons-logging</groupId>

<artifactId>commons-logging</artifactId>

<version>1.2</version>

</dependency>


<dependency>

<groupId>org.apache.commons</groupId>

<artifactId>commons-lang3</artifactId>

<version>3.7</version>

</dependency>


<dependency>

<groupId>org.apache.commons</groupId>

<artifactId>commons-collections4</artifactId>

<version>4.1</version>

</dependency>


<dependency>

<groupId>org.apache.commons</groupId>

<artifactId>commons-math</artifactId>

<version>2.2</version>

</dependency>

<dependency>

<groupId>org.apache.commons</groupId>

<artifactId>commons-digester3</artifactId>

<version>3.2</version>

</dependency>


<dependency>

<groupId>com.jolbox</groupId>

<artifactId>bonecp</artifactId>

<version>0.8.0.RELEASE</version>

</dependency>


<dependency>

<groupId>org.slf4j</groupId>

<artifactId>slf4j-api</artifactId>

<version>1.7.25</version>

</dependency>


<dependency>

<groupId>org.slf4j</groupId>

<artifactId>slf4j-log4j12</artifactId>

<version>1.7.25</version>

<scope>test</scope>

</dependency>


<dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<version>4.12</version>

<scope>test</scope>

</dependency>


<dependency>

<groupId>org.freemarker</groupId>

<artifactId>freemarker</artifactId>

<version>2.3.28</version>

</dependency>


<dependency>

<groupId>mysql</groupId>

<artifactId>mysql-connector-java</artifactId>

<version>5.1.46</version>

</dependency>


<dependency>

<groupId>dom4j</groupId>

<artifactId>dom4j</artifactId>

<version>1.6.1</version>

</dependency>

<dependency>

<groupId>net.sf.json-lib</groupId>

<artifactId>json-lib</artifactId>

<version>2.4</version>

<classifier>jdk15</classifier>

</dependency>


<dependency>

<groupId>commons-httpclient</groupId>

<artifactId>commons-httpclient</artifactId>

<version>3.1</version>

</dependency>


<dependency>

<groupId>org.apache.poi</groupId>

<artifactId>poi</artifactId>

<version>3.9</version>

</dependency>


<dependency>

<groupId>it.sauronsoftware.cron4j</groupId>

<artifactId>cron4j</artifactId>

<version>2.2.5</version>

</dependency>

<dependency>

  <groupId>com.jfinal</groupId>

  <artifactId>jfinal-ext2</artifactId>

  <version>2.0.2</version>

</dependency>


</dependencies>

  

  <build>

    <finalName>ROOT</finalName>

    <plugins>

  <plugin>

    <groupId>org.mortbay.jetty</groupId>

    <artifactId>jetty-maven-plugin</artifactId>

    <version>8.1.8.v20121106</version>

    <configuration>

        <stopKey>stop</stopKey>

        <stopPort>5599</stopPort>

        <webAppConfig>

            <contextPath>/</contextPath>

        </webAppConfig>

        <scanIntervalSeconds>5</scanIntervalSeconds>

        <connectors>

            <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">

                <port>80</port>

                <maxIdleTime>60000</maxIdleTime>

            </connector>

        </connectors>

    </configuration>

  </plugin>

  </plugins>

  </build>

</project>

  


评论区

阿呆

2018-07-07 11:39

07-Jul-2018 11:25:48.256 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.52
07-Jul-2018 11:25:48.259 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Apr 28 2018 16:24:29 UTC
07-Jul-2018 11:25:48.260 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.52.0
07-Jul-2018 11:25:48.260 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 10
07-Jul-2018 11:25:48.260 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 10.0
07-Jul-2018 11:25:48.260 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
07-Jul-2018 11:25:48.260 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: C:\Java\jdk1.8.0_171\jre
07-Jul-2018 11:25:48.260 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_171-b11
07-Jul-2018 11:25:48.260 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
07-Jul-2018 11:25:48.260 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: D:\apache-tomcat
07-Jul-2018 11:25:48.260 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: D:\apache-tomcat

阿呆

2018-07-07 11:40

求助,谢谢

阿呆

2018-07-07 11:53

tomcat log 报错信息如下:
07-Jul-2018 10:06:25.480 严重 [localhost-startStop-1] org.apache.catalina.core.StandardContext.filterStart Exception starting filter jfinal
java.lang.NoClassDefFoundError: com/jfinal/log/ILoggerFactory
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.jfinal.core.JFinalFilter.createJFinalConfig(JFinalFilter.java:101)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:47)
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:4747)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5389)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:755)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:731)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:973)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1850)
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.jfinal.log.ILoggerFactory
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1352)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
... 20 more

JFinal

2018-07-07 16:15

NoClassDefFoundError 是 java 基础,参考一下这里:
http://www.jfinal.com/feedback/3058

阿呆

2018-07-07 19:26

http://www.jfinal.com/feedback/3058, 已经试过了, .m2 仓库更新, ROOT.war部署到 tomcat,启动不了, 在myeclipse 下,jetty 没问题,

阿呆

2018-07-07 19:27

先参考的:http://www.jfinal.com/feedback/3058, 后发的该帖

阿呆

2018-07-09 20:41

自己顶下

JFinal

2018-07-09 23:48

@阿呆这者几天过去了,还没解决?

阿呆

2018-07-13 09:58

javamelody 、 bonecp 、 log4j 、 jfinal3.3 貌似冲突,水平有限,还没;

阿呆

2018-07-13 09:59

生产环境部署,tomcat 启动不了

阿呆

2018-07-13 10:00

项目先用springboot了

JFinal

2018-07-13 10:14

@阿呆 你的异常提示中出现了 ILoggerFactory, 证明有老版本的 jfinal 被同时依赖,应该是 jfinal-ext2 这个第三方中包含进来的,使用 exclusion 配置排除掉,或者直接删掉 jfinal-ext2

还有一个更简单的办法是用 eclipse 打开 pom.xml , 再点击下方的 Dependency Hierarchy 视图,可以看到多个 jfinal 版本被依赖,想办法去掉其中低版本那个

热门反馈

扫码入社