Zipkin 错误:在类路径资源中定义的名称为 'webMvcMetricsFilter' 的 bean 创建失败。

5
当我尝试集成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
  • SpringCloud Hoxton.SR1(sleuth: 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>

1
嗨,你解决问题了吗?我也有同样的问题。 - Bahramdun Adil
2个回答

0

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


0

你的应用程序在Tomcat服务器中启动,但Zipkin使用另一个服务器,但我不知道那个服务器的名称,我将这段代码包含在Spring Boot Starter Web依赖项中以忽略Tomcat服务器。

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

这对我有效,你也试试吧


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接