首页 > 代码库 > Maven项目java.lang.NoClassDefFoundError: Lorg/apache/log4j/Logger报错

Maven项目java.lang.NoClassDefFoundError: Lorg/apache/log4j/Logger报错

本文转载自:http://www.javaweb1024.com/info/894.jspx

maven管理的项目,里面已经引入了log4j的包

maven引入如下:

<dependency>      <groupId>log4j</groupId>      <artifactId>log4j</artifactId>      <version>1.2.16</version>      <scope>compile</scope> </dependency>

但还是报

Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]

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

... 6 more

Caused by: java.lang.NoClassDefFoundError: Lorg/apache/log4j/Logger;

看了下tomcat项目中lib 下,maven的包没有到过来,感觉很奇怪.昨天项目还是OK的

修改如下:

技术分享

add中选择

技术分享

问题搞定

Maven项目java.lang.NoClassDefFoundError: Lorg/apache/log4j/Logger报错