记一次slf4j 异常分析
异常
SLF4J: The requested version 1.6.99 by your slf4j binding is not compatible with [1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10, 1.5.11] SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details. [WARN][18-11-14 11:52:57,418][org.springframework.web.context.support.XmlWebApplicationContext]org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:488) Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'careTask': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userCareNumChangeProducer': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.arrayFormat(Ljava/lang/String;[Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple; [ERROR][18-11-14 11:52:57,423][org.springframework.web.context.ContextLoader]org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:331) Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'careTask': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userCareNumChangeProducer': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.arrayFormat(Ljava/lang/String;[Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;
多为jar包冲突;比较坑的是在activemq-all-5.5.0.jar里包含了低版本 slf4j的 class 文件,如果依赖该 jar 并同时使用slf4j 就会报上面的异常

浙公网安备 33010602011771号