- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在 Tomcat 上部署 Spring Boot 应用程序。但不知何故,我得到了:
Unexpected problem occured during version sanity check
Reported exception:
java.lang.AbstractMethodError: org.apache.logging.slf4j.SLF4JServiceProvider.getRequestedApiVersion()Ljava/lang/String;
at org.slf4j.LoggerFactory.versionSanityCheck(LoggerFactory.java:297)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:141)
at org.slf4j.LoggerFactory.getProvider(LoggerFactory.java:421)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:407)
at io.micrometer.core.util.internal.logging.Slf4JLoggerFactory.<init>(Slf4JLoggerFactory.java:49)
at io.micrometer.core.util.internal.logging.Slf4JLoggerFactory.<clinit>(Slf4JLoggerFactory.java:46)
at io.micrometer.core.util.internal.logging.InternalLoggerFactory.newDefaultFactory(InternalLoggerFactory.java:60)
at io.micrometer.core.util.internal.logging.InternalLoggerFactory.getDefaultFactory(InternalLoggerFactory.java:76)
at io.micrometer.core.util.internal.logging.InternalLoggerFactory.getInstance(InternalLoggerFactory.java:108)
at io.micrometer.core.util.internal.logging.InternalLoggerFactory.getInstance(InternalLoggerFactory.java:98)
at io.micrometer.core.instrument.binder.jvm.JvmGcMetrics.<clinit>(JvmGcMetrics.java:61)
at org.springframework.boot.actuate.autoconfigure.metrics.JvmMetricsAutoConfiguration.jvmGcMetrics(JvmMetricsAutoConfiguration.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
我在一个通用类加载器中有几个 SLF4J/Log4J2 jar,用于其他一些 web 应用程序。
喜欢:
log4j-api-2.14.1.jar
log4j-core-2.14.1.jar
log4j-over-slf4j-2.0.0-alpha5.jar
log4j-slf4j18-impl-2.14.1.jar
slf4j-api-2.0.0-alpha5.jar
我以为是 slf4j jar 和 spring WAR 的 jar 冲突。所以我从 Spring 应用程序中排除了所有 sllf4j 项目,认为它会从公共(public)加载器中选择类。但我收到上述错误。该应用程序启动良好,没有任何问题。但不知道如何摆脱这个。我的 spring 应用程序 pom 的最终依赖部分是这样的:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
</dependencies>
最佳答案
您似乎在 log4j-slf4j18-impl
库中发现了一个错字。slf4j-api:2.0.0-alpha5
的 LoggerFactory 尝试从提供者 (source) 获取请求的 api 版本:
String requested = PROVIDER.getRequestedApiVersion();
但似乎实际实现只有一个名为 getRequesteApiVersion 的方法
我鼓励你在 Apache 的 issue tracker 中打开一个问题。对这个。
编辑:我在 Apache 问题跟踪器 (https://issues.apache.org/jira/browse/LOG4J2-3139) 中发现了类似的问题。基于该信息,Slf4J 对 2.0 版本进行了非向后兼容更改(将 getRequesteApiVersion 方法更改为 getRequestedApiVersion)。由于 Slf4J 目前处于 alpha 版本,因此 Apache 只会在 Slf4j 稳定版本发布后修复此问题。
您可以尝试为 Slf4J 指定另一个提供程序或隐式使用旧版本的 Slf4j。
关于spring - 版本健全性检查 (Spring/SLF4J),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69944643/
我正在尝试用 Rust 中的父指针制作一棵树。节点结构上的一种方法给我带来了终身问题。这是一个最小的例子,明确地写了生命周期,以便我可以理解它们: use core::mem::transmute;
我是一名优秀的程序员,十分优秀!