Caused by: java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format

如果项目启动报如下的错误,可能是由于 jar 包冲突引起的。
错误信息:

Caused by: java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String;
        at org.slf4j.impl.SimpleLogger.formatAndLog(SimpleLogger.java:222)
        at org.slf4j.impl.SimpleLogger.warn(SimpleLogger.java:305)
        at com.jd.jim.cli.clientId.DefaultClientIdProvider.getAppName(DefaultClientIdProvider.java:88)
        at com.jd.jim.cli.clientId.DefaultClientIdProvider.getClientId(DefaultClientIdProvider.java:36)
        at com.jd.jim.cli.JimClientFactory.getClientId(JimClientFactory.java:86)
        at com.jd.jim.cli.ReloadableJimClientFactory.init(ReloadableJimClientFactory.java:177)
        at com.jd.jim.cli.ReloadableJimClientFactory.retryInit(ReloadableJimClientFactory.java:150)
        at com.jd.jim.cli.ReloadableJimClientFactory.getClient(ReloadableJimClientFactory.java:71)
        at com.jd.jim.cli.ReloadableJimClientFactoryBean.getObject(ReloadableJimClientFactoryBean.java:19)
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
        ... 98 more

解决方法排除 slf4j-simple 日志包:

<exclusions>
    <exclusion>
        <artifactId>slf4j-simpleartifactId>
        <groupId>org.slf4jgroupId>
    exclusion>
exclusions>

你可能感兴趣的:(技术实践)