- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在新的 Spring Boot 应用程序中,当我 gradle bootRun
时,我看到以下错误:
Failed to instantiate [ch.qos.logback.classic.LoggerContext]
Reported exception:
java.lang.AbstractMethodError: ch.qos.logback.classic.pattern.EnsureExceptionHandling.process(Lch/qos/logback/core/Context;Lch/qos/logback/core/pattern/Converter;)V
at ch.qos.logback.core.pattern.PatternLayoutBase.start(PatternLayoutBase.java:86)
at ch.qos.logback.classic.encoder.PatternLayoutEncoder.start(PatternLayoutEncoder.java:28)
at ch.qos.logback.classic.BasicConfigurator.configure(BasicConfigurator.java:50)
at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:164)
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:150)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:412)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
at com.klarna.risk.decision.application.RiskDecisionApplication.<clinit>(RiskDecisionApplication.java:14)
build.gradle
:
buildscript {
repositories {
jcenter()
maven { url 'http://repo.spring.io/release' }
}
dependencies {
classpath 'org.gretty:gretty:+'
}
}
plugins {
id 'org.springframework.boot' version '2.1.9.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
id 'war'
}
apply plugin: 'org.gretty'
repositories {
jcenter()
maven { url 'http://repo.spring.io/release' }
}
gretty { // for Gradle 4.0+
springBoot = true
springBootVersion = '2.1.9.RELEASE'
httpPort = 8080
contextPath = ''
}
repositories {
mavenCentral()
}
group = 'com.example.newapp'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceSets {
test {
java {
srcDirs = ['src/test/java', 'src/api-test/java']
}
}
}
configurations {
compile.exclude module: "spring-boot-starter-tomcat"
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
implementation "org.springframework.boot:spring-boot-starter-jetty"
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
问题是什么?
最佳答案
当我检查gradle dependencyInsight --dependency logback
时,我看到:
> Task :dependencyInsight
ch.qos.logback:logback-classic:1.1.3 (selected by rule)
variant "compile" [
org.gradle.status = release (not requested)
org.gradle.usage = java-api
org.gradle.libraryelements = jar (compatible with: classes)
org.gradle.category = library (not requested)
Requested attributes not found in the selected variant:
org.gradle.dependency.bundling = external
org.gradle.jvm.version = 8
]
ch.qos.logback:logback-classic:1.1.3
\--- compileClasspath
ch.qos.logback:logback-classic:1.2.3 -> 1.1.3
\--- org.springframework.boot:spring-boot-starter-logging:2.1.9.RELEASE
\--- org.springframework.boot:spring-boot-starter:2.1.9.RELEASE
+--- compileClasspath (requested org.springframework.boot:spring-boot-starter)
+--- org.springframework.boot:spring-boot-starter-web:2.1.9.RELEASE
| +--- compileClasspath (requested org.springframework.boot:spring-boot-starter-web)
| \--- org.springframework.boot:spring-boot-starter-websocket:2.1.9.RELEASE
| \--- compileClasspath
+--- org.springframework.boot:spring-boot-starter-json:2.1.9.RELEASE
| +--- org.springframework.boot:spring-boot-starter-web:2.1.9.RELEASE (*)
| \--- org.springframework.boot:spring-boot-starter-jersey:2.1.9.RELEASE
| \--- compileClasspath (requested org.springframework.boot:spring-boot-starter-jersey)
\--- org.springframework.boot:spring-boot-starter-validation:2.1.9.RELEASE
\--- org.springframework.boot:spring-boot-starter-jersey:2.1.9.RELEASE (*)
ch.qos.logback:logback-core:1.2.3 (selected by rule)
variant "compile" [
org.gradle.status = release (not requested)
org.gradle.usage = java-api
org.gradle.libraryelements = jar (compatible with: classes)
org.gradle.category = library (not requested)
Requested attributes not found in the selected variant:
org.gradle.dependency.bundling = external
org.gradle.jvm.version = 8
]
ch.qos.logback:logback-core:1.1.3 -> 1.2.3
\--- ch.qos.logback:logback-classic:1.1.3
+--- compileClasspath
\--- org.springframework.boot:spring-boot-starter-logging:2.1.9.RELEASE (requested ch.qos.logback:logback-classic:1.2.3)
\--- org.springframework.boot:spring-boot-starter:2.1.9.RELEASE
+--- compileClasspath (requested org.springframework.boot:spring-boot-starter)
+--- org.springframework.boot:spring-boot-starter-web:2.1.9.RELEASE
| +--- compileClasspath (requested org.springframework.boot:spring-boot-starter-web)
| \--- org.springframework.boot:spring-boot-starter-websocket:2.1.9.RELEASE
| \--- compileClasspath
+--- org.springframework.boot:spring-boot-starter-json:2.1.9.RELEASE
| +--- org.springframework.boot:spring-boot-starter-web:2.1.9.RELEASE (*)
| \--- org.springframework.boot:spring-boot-starter-jersey:2.1.9.RELEASE
| \--- compileClasspath (requested org.springframework.boot:spring-boot-starter-jersey)
\--- org.springframework.boot:spring-boot-starter-validation:2.1.9.RELEASE
\--- org.springframework.boot:spring-boot-starter-jersey:2.1.9.RELEASE (*)
(*) - dependencies omitted (listed previously)
A web-based, searchable dependency report is available by adding the --scan option.
似乎 Spring Boot 2.1.9 使用的是 org.springframework.boot:spring-boot-starter-logging:2.1.9.RELEASE
,它使用 logback-classic:1.1。 3.
。 Google 的某个地方告诉我 Spring Boot 依赖管理有一个错误,该错误允许使用不同版本的 logback-core
和 logback-classic
并导致冲突。
我添加了logback-core:1.1.3
的依赖,问题就消失了。
compile group: 'ch.qos.logback', name: 'logback-core', version: '1.1.3'
如果您遇到同样的问题,请务必检查 Spring Boot 中使用的 logback 版本。
关于java - Spring Boot/Gradle/Logback : bootRun fails with "Failed to instantiate [ch.qos.logback.classic.LoggerContext]": java. lang.AbstractMethodError:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58260835/
package practicejava; public class Query { public static void main(String[] args) { char
因为我很困惑其中会存储什么。它是 ascii 值还是“z”,因为有些网站说它存储 ascii,有些网站说它存储“z”。链接说答案是“z”:http://cprogrammingworld4u.blog
这个问题在这里已经有了答案: mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows etc... expec
我无法将字符指针数组 s 的字符存储到字符数组 ch 中: int main() { char *s; s = malloc(1024 * sizeof(char));
我有这个代码: int main() { char ch[15]; cout<
在看《C++ Primer Plus 5th edition》时,看到了这样一段代码: cin.get(ch); ++ch; cout void print_type(cha
这行代码做了什么? char_to_ix = { ch:i for i,ch in enumerate(sorted(chars)) } ch:i 是什么意思? 最佳答案 这是@han solo 中提
这行代码做了什么? char_to_ix = { ch:i for i,ch in enumerate(sorted(chars)) } ch:i 是什么意思? 最佳答案 这是@han solo 中提
我在关注《C Primer Plus》这本书,遇到这样一段代码: // echo_eof.c -- repeats input to end of file. #include int main(v
这个问题在这里已经有了答案: Difference between int* a and int *a [duplicate] (2 个答案) Why is the asterisk before
我正在运行单个 goroutine 来处理与某些用户相关的消息 channel 。处理消息后,用户状态由 goroutine 更新并存储在数据库中。当对数据库的请求正在进行时,可以将许多消息发送到 c
这是完整的代码: s = 'life is short, stunt it!!?' from string import punctuation tbl = str.maketrans({ord(ch
在 C++ 中,(int) ch 是否等同于 int(ch)。 如果不是,有什么区别? 最佳答案 它们是同一个东西,也和(int)(ch)一样.在 C++ 中,通常首选使用命名转换来阐明您的意图: 使
我在 php 中使用 cURL。注意到每次启动 curl 案例时,人们总是把: $ch=curl_init(); “$ch”是什么意思? curl -F template_invoke_name='s
我正在编写与对齐相关的代码,如果给定的指针正确对齐,却没有标准的功能测试,这让我感到非常惊讶。 似乎互联网上的大多数代码都使用(long)ptr或 reinterpret_cast(ptr)测试对齐,
这个问题已经有答案了: C skipping one command of a function? [duplicate] (2 个回答) 已关闭 5 年前。 scanf("%c", &ch ) sc
然后我遇到了系统调用“write”,我尝试将“putchar”与“write”进行比较。现在,我对上面的代码行感到困惑。 最佳答案 putchar 是一个库函数。它调用 write 系统调用将字符写入
在 codechef 上用于更快输入输出的许多解决方案中,我遇到过这个表达式,但我无法理解它,因为我没有很多经验。 inline int scan( ) { int n=0; int ch=getch
这个问题在这里已经有了答案: What does space in scanf mean? [duplicate] (6 个答案) 关闭 7 年前。 像这样在scanf中加一个空格的目的是什么 sc
我的 spring-boot 应用程序中有以下 logback.xml: ... ...
我是一名优秀的程序员,十分优秀!