spring-boot从1.3.2升级到1.3.3:logback问题

时间:2016-03-02 04:43:04

标签: spring neo4j spring-boot logback spring-data-neo4j-4

从spring-boot 1.3.2升级到最近发布的1.3.3时,我们遇到了一个问题。

我们的应用程序一直在使用以下依赖项,每个依赖项都是最新的,没有问题:

    <neo4j.version>2.3.2</neo4j.version>
    <sdn.version>4.0.0.RELEASE</sdn.version>
    <sdn.rest.version>3.4.0.RELEASE</sdn.rest.version>
    <neo4j.ogm.version>1.1.5</neo4j.ogm.version>

今天我升级了我们的spring-boot和基于Spring Data Neo4j的应用程序,它通过改变pom.xml来启动并与spring-boot 1.3.2.RELEASE一起运行良好:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.3.2.RELEASE</version>
</parent>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.3.3.RELEASE</version>
</parent>

这实际上是唯一的变化,应用程序现在无法启动以下错误:

...

Failed to instantiate [ch.qos.logback.classic.LoggerContext]
Reported exception:
java.lang.AbstractMethodError: ch.qos.logback.classic.pattern.EnsureExceptionHandling.process(Lch/qos/logback/core/pattern/Converter;)V
    at ch.qos.logback.core.pattern.PatternLayoutBase.start(PatternLayoutBase.java:88)
    at ch.qos.logback.classic.encoder.PatternLayoutEncoder.start(PatternLayoutEncoder.java:28)
    at ch.qos.logback.core.joran.action.NestedComplexPropertyIA.end(NestedComplexPropertyIA.java:167)
    at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:317)
    at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:196)
    at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:182)
    at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:149)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:49)
    at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:77)
    at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:152)
    at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
    at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
    at org.slf4j.LoggerFactory.bind(LoggerFactory.java:143)
    at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:122)
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:378)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:328)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:349)
    at com.mycompany.Application.<clinit>(Application.java:35)

正如预期的那样,返回1.3.2.RELEASE不会引起任何问题。

到目前为止搜索显示没有可追踪的踪迹。比较使用spring-boot 1.3.2.RELEASE和1.3.3.RELEASE之间的mvn dependency:tree输出,我可以看到ch.qos.logback的瞬态依赖:logback-classic和ch.qos.logback:logback -access jar已经从1.8.3 for spring-boot 1.3.2.RELEASE更改为1.1.5 for spring-boot 1.3.3.RELEASE,而ch.qos.logback:logback-core仍为1.1.3 -boot flavors。

有没有人知道底层问题是什么(我猜测未能实例化的类已被删除或重新定位)和/或 - 更重要的是 - 我可以做些什么来解决它? / p>

1 个答案:

答案 0 :(得分:23)

Spring Boot缺少logback-core的一些依赖管理,允许不同的版本进入。我已经打开an issue来解决这个问题。

与此同时,您可以通过将自己的依赖关系管理添加到您的pom来避免此问题:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>${logback.version}</version>
        </dependency>
    </dependencies>
</dependencyManagement>