java.lang.NoClassDefFoundError: org/apache/log4j/xml/DOMConfigurator
原创    baibai    发表于:2018-01-19 18:10:55
  阅读 :722   收藏   编辑

maven 项目启动出错:

java.lang.NoClassDefFoundError: org/apache/log4j/xml/DOMConfigurator
    at org.springframework.util.Log4jConfigurer.initLogging(Log4jConfigurer.java:75)
    at org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:153)
    at org.springframework.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:45)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.xml.DOMConfigurator
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
    ... 12 more

解决:

缺少log4j.jar包

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.17</version>
</dependency>

更多版本仓库地址:http://mvnrepository.com/artifact/log4j/log4j

评论
条评论

推荐阅读