标签:div logger tree http log4 src -o 时间 cto
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.log4j.Log4jLoggerFactory
缺Log4j不可能,绝对不可能,同个版本的代码刚刚还在Jenkins上起来的。怎么办,仔细读下日志,发现有如下提示:
很明显了,看来是log4j-over-slf4j.jar 和 slf4j-log4j12.jar 不能在同一个class path。
mvn -X compile dependency:tree -Dverbose >a.log
2. 排除依赖,即可。
<dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-cas</artifactId> <version>${spring.security.version}</version> <exclusions> <exclusion> <groupId>org.slf4j</groupId> <artifactId>log4j-over-slf4j</artifactId> </exclusion> <exclusion> <groupId>org.slf4j</groupId> <artifactId>jul-to-slf4j</artifactId> </exclusion> <exclusion> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </exclusion> </exclusions> </dependency>
【原】Could not initialize class org.apache.log4j.Log4jLoggerFactory
标签:div logger tree http log4 src -o 时间 cto
原文地址:https://www.cnblogs.com/cooqer/p/9444009.html