SLF4J: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError.
SLF4J: See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
Exception in thread "main" java.lang.ExceptionInInitializerError
 at org.apache.log4j.LogManager.getLogger(LogManager.java:44)
 at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:66)
 at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:277)
 at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:288)
....
Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError. See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
 at org.apache.log4j.Log4jLoggerFactory.<clinit>(Log4jLoggerFactory.java:51)
 ... 11 more

原因是引用了两个关于log4j的jar,造成死循环

log4j-over-slf4j-1.7.7.jar

slf4j-log4j12-1.7.7.jar

但只引用slf4j-log4j12-1.7.7.jar会提示org.apache.log4j.Level这个class找不到

要使用log4j记录日志,其实只用引用log4j-over-slf4j-1.7.7.jar就可以了

http://www.360doc.com/content/10/0908/15/1542811_52121394.shtml

Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError的更多相关文章

  1. 转:Caused by: java.lang.NoSuchMethodError: org.apache.log4j.Category.log

    Caused by: java.lang.NoSuchMethodError: org.apache.log4j.Category.log出现的异常:java.lang.reflect.Invocat ...

  2. 【spring boot】【elasticsearch】spring boot整合elasticsearch,启动报错Caused by: java.lang.IllegalStateException: availableProcessors is already set to [8], rejecting [8

    spring boot整合elasticsearch, 启动报错: Caused by: java.lang.IllegalStateException: availableProcessors ], ...

  3. Caused by: java.lang.IllegalStateException: Method has too many Body parameters

    feign多参数问题1.1GET方式错误写法 @RequestMapping(value="/test", method=RequestMethod.GET) Model test ...

  4. Caused by:java.lang.IllegalStateException at android.media.MediaPlayer._setDataSource(Native Method)

    使用Mediaplayer播放本地音频,在第二次调用mediaplayer.setDataSource()时报错如下: Caused by: java.lang.IllegalStateExcepti ...

  5. Caused by: java.lang.IllegalStateException: Expected raw type form of org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$Match

    spring 4.0.2,mybatis 3.2.6,aspectjweaver 1.8.10 使用的时候,报错: Caused by: java.lang.IllegalStateException ...

  6. IDEA里运行代码时出现Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger的解决办法(图文详解)

    不多说,直接上干货! 问题详情 运行出现log4j的问题 -classpath "C:\Program Files\Java\jdk1.8.0_66\jre\lib\charsets.jar ...

  7. Caused by java.lang.IllegalStateException Not allowed to start service Intent { cmp=com.x.x.x/.x.x.xService }: app is in background uid UidRecord(一)

    Caused by java.lang.IllegalStateException Not allowed to start service Intent { cmp=com.x.x.x/.x.x.x ...

  8. Caused by: java.lang.IllegalStateException: javax.websocket.server.ServerContainer not available

    java.lang.IllegalStateException: Failed to load ApplicationContext    at org.springframework.test.co ...

  9. Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger

    myeclipse 新建web项目,报错Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger,查看项目中已经有引入了 ...

随机推荐

  1. HDU 2189 悼念512汶川大地震遇难同胞――来生一起走 --生成函数

    这题跟上两题也差不多. 把150以内的素数找出来,把素数的值看做硬币的面值,每个硬币的个数即ceil(150/prime[i]),因为再多也没用,最多组成n=150就行了,所以又回到了找硬币问题.用生 ...

  2. 使用Unity3D引擎开发赛车游戏

    Car Tutorial 在Unity3D的Asset Store有一个赛车的Demo —— Car Tutorial,看起来特别酷的赛车游戏Demo,不过我还没有下载下来,因为在公司下载Assets ...

  3. 敏捷软件开发 原则 模式 与实践 - OCP原则

    最近在读BOB大叔的敏捷软件开发,特别是TDD那一章节,启示真的不少,从测试驱动开发,讲到驱动表明程序设计的意图,从设计意图讲到对象依赖的解耦,从解耦建立Mock对象. 其实是对每个模块都编写单元测试 ...

  4. React Native iOS环境搭建

    前段时间React Native for Android发布,感觉React Native会越来越多的公司开始研究.使用.所以周六也抽空搭建了iOS的开发环境,以便以后利用空闲的时间能够学习一下. 废 ...

  5. addEvent和removeEvent优化写法

    ;(function(){ /** * 初始化分支是一种优化模式,当知道某个条件在整个生命周期内都不会发生变化时,仅对该条件测试一次. */ // 一般写法 var util = { addEvent ...

  6. isAnimated函数

    function isAnimated($obj){ var flag=false; if($obj.is(":animated")){ flag=true; } return f ...

  7. Java系列:JVM指令详解(下)(zz)

    九.自增减指令    20:iconst_1    21:istore_1    22:return 指令码      助记符                                     ...

  8. 对于JVM内存配置参数

    -Xmx:最大堆大小 -Xms:初始堆大小 -Xmn:年轻代大小 -XXSurvivorRatio:年轻代中Eden区与Survivor区的大小比值 年轻代5120m, Eden:Survivor=3 ...

  9. LeetCode:Search Insert Position,Search for a Range (二分查找,lower_bound,upper_bound)

    Search Insert Position Given a sorted array and a target value, return the index if the target is fo ...

  10. count(*) vs count(1)--social.msdn.microsoft.com

    Clever response Dave, but insufficient. I'll admit I've suggested this myself for certain questions ...