zipkin错误创建类路径资源中定义的名为“webMvcMetricsFilter”的bean时出错

w8rqjzmb  于 2022-09-19  发布在  Spring
关注(0)|答案(2)|浏览(225)

当我尝试集成zipkin时。它抛出了这个错误

Error Msg:Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'webMvcMetricsFilter' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/web/servlet/WebMvcMetricsAutoConfiguration.class]: Unsatisfied dependency expressed through method 'webMvcMetricsFilter' parameter 0;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'prometheusMeterRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusMetricsExportAutoConfiguration.class]: Initialization of bean failed;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'zipkin2.server.internal.ZipkinServerConfiguration': Unsatisfied dependency expressed through field 'httpQuery';
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'zipkin2.server.internal.ZipkinQueryApiV2': Bean instantiation via constructor failed;
nested exception is java.lang.NoClassDefFoundError: zipkin2/internal/Buffer$Writer

版本:

  • Springboot 2.2.4
  • 斯普林克劳德·霍克斯顿。SR1(侦探:2.2.1)
  • zipkin 2.19.9
@EnableZipkinServer
@SpringBootApplication
public class C4ZipkinApplication {

    public static void main(String[] args) {
        SpringApplication.run(C4ZipkinApplication.class, args);
    }

}
<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
   <groupId>io.zipkin.java</groupId>
   <artifactId>zipkin-server</artifactId>
</dependency>
<dependency>
   <groupId>io.zipkin.java</groupId>
   <artifactId>zipkin-autoconfigure-ui</artifactId>
</dependency>
nue99wik

nue99wik1#

您的应用程序在Tomcat服务器中启动,但Zipkin使用另一个服务器,但我不知道这个名称,我包含了这段代码,用于忽略Tomcat服务器的spring boot starter web依赖性

<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>

这对我有用,试试看

hs1ihplo

hs1ihplo2#

如果您使用的是配置服务器,请记住在运行微服务之前先运行它。

相关问题