【问题标题】:zipkin error Error creating bean with name 'webMvcMetricsFilter' defined in class path resourcezipkin 错误在类路径资源中定义名称为“webMvcMetricsFilter”的 bean 创建错误
【发布时间】:2026-01-12 03:00:02
【问题描述】:

当我尝试集成 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(侦探: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>

【问题讨论】:

  • 您好,您的问题解决了吗?我也有同样的问题。

标签: spring-boot spring-cloud zipkin


【解决方案1】:

您的应用程序在 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>

这对我有用,试试吧

【讨论】:

    最近更新 更多