-1

我们正在使用 spring boot 1.4.0.RELEASE 将 grails 版本 3.0.9 升级到 3.1.10,当我尝试编译时出现此错误:

Failed to instantiate [ch.qos.logback.classic.LoggerContext]
Reported exception:
java.lang.NoSuchMethodError: ch.qos.logback.core.util.Loader.getResourceOccurrenceCount(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljava/util/Set;
    at ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning(ContextInitializer.java:173)
    at ch.qos.logback.classic.util.ContextInitializer.statusOnResourceSearch(ContextInitializer.java:196)
    at ch.qos.logback.classic.util.ContextInitializer.getResource(ContextInitializer.java:143)
    at ch.qos.logback.classic.util.ContextInitializer.findURLOfDefaultConfigurationFile(ContextInitializer.java:127)
    at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
    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:140)
    at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:119)
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:328)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:280)
    at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
    at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:290)
    at org.apache.commons.logging.LogFactory$getLog.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
    at ciab.base.Application.<clinit>(Application.groovy)
Exception in thread "main" java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationContextInitializer : org.springframework.boot.autoconfigure.SharedMetadataReaderFactoryContextInitializer
    at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:412)
    at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:392)
    at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:383)
    at org.springframework.boot.SpringApplication.initialize(SpringApplication.java:261)
    at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:237)
    at grails.boot.GrailsApp.<init>(GrailsApp.groovy)
    at grails.boot.GrailsApp.run(GrailsApp.groovy:374)
    at grails.boot.GrailsApp.run(GrailsApp.groovy:363)
    at grails.boot.GrailsApp$run.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)    
Caused by: java.lang.NoSuchMethodException: org.springframework.boot.autoconfigure.SharedMetadataReaderFactoryContextInitializer.<init>()
    at java.lang.Class.getConstructor0(Class.java:3082)
    at java.lang.Class.getConstructor(Class.java:1825)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetConstructor(ReflectiveInterceptor.java:524)
    at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:407)
    ... 12 more

知道出了什么问题,我试图排除 logback-core 但没有运气。请让我知道任何修复。

谢谢斯里

4

1 回答 1

0

Grails 3.1.x 与 Spring Boot 1.3.x 兼容

要使用 Spring Boot 1.4.x,您需要使用即将发布但在撰写本文时处于里程碑阶段的 Grails 3.2.x。

于 2016-08-23T10:23:36.157 回答