添加 sleuth 和 zipkin 时应用程序无法启动

     2023-02-16     147

关键词:

【中文标题】添加 sleuth 和 zipkin 时应用程序无法启动【英文标题】:app fails to start when sleuth and zipkin are added 【发布时间】:2017-07-13 04:08:58 【问题描述】:

我有一个要更新到 1.5.1 的 Spring Boot 应用程序。效果很好,直到我将 Sleuth 和 Zipkin 添加到类路径

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-sleuth</artifactId>
    </dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>

当这些行出现时,我得到

2017-02-22 22:33:05.331 ERROR [chathub-api,,,] 7581 --- [           main] o.s.boot.SpringApplication               : Application startup failed

java.lang.NoClassDefFoundError: org/springframework/boot/context/embedded/FilterRegistrationBean

这是我的部门。管理

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Camden.SR4</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

我尝试更改为 Dalston

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Dalston.BUILD-SNAPSHOT</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <repositories>
        <repository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/libs-snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

但错误变得更加奇怪

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method envInfoContributor in org.springframework.boot.actuate.autoconfigure.InfoContributorAutoConfiguration required a bean of type 'org.springframework.core.env.ConfigurableEnvironment' that could not be found.

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'traceWebFilter' defined in class path resource [org/springframework/cloud/sleuth/instrument/web/TraceWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'traceWebFilter' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'traceFilter' defined in class path resource [org/springframework/cloud/sleuth/instrument/web/TraceWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'traceFilter' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sleuthTracer' defined in class path resource [org/springframework/cloud/sleuth/autoconfig/TraceAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sleuthTracer' parameter 4; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'zipkinSpanListener' defined in class path resource [org/springframework/cloud/sleuth/zipkin/ZipkinAutoConfiguration.class]: Unsatisfied dependency expressed through method 'zipkinSpanListener' parameter 2; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.core.env.Environment' available: expected at least 1 bean which qualifies as autowire candidate. Dependenc...

我错过了什么我还没有注意到的东西吗?

【问题讨论】:

【参考方案1】:

即使我在设置项目时也遇到了这个错误。我在 Brixton.SR6 版本中使用 Spring boot 1.5.8。但是,当我访问http://projects.spring.io/spring-cloud/ 网站时,我知道了这个问题,我将我的依赖项更新为 Dalston.SR4,然后应用程序开始工作。

【讨论】:

【参考方案2】:

我无法解释您使用 Dalston.BUILD-SNAPSHOT 时遇到的错误,但 Camden.SR4 的错误是因为它与 Spring Boot 1.5 不兼容。我建议升级到 Camden.SR5 which is compatible with Spring Boot 1.5。

【讨论】:

对不起,同样的错误:No qualifying bean of type 'org.springframework.core.env.Environment。有趣的是,在快速入门部分的projects.spring.io/spring-cloud 上,如果我选择 Camdem.SR5,它会将 SB 版本更改为 1.4.4.RELEASE,这可能会引起一些混乱。网站过时了吗?

Spring cloud sleuth 没有与 Zipkin 一起运行

...门课有一个小问题brave.sampler.Sampler无法导入此类,仅在我添加此依赖项时导入<dependency><groupId>io.zipkin.brave</groupId& 查看详情

当 spring-cloud-starter-zipkin 使用 zipkin.brave 时,为啥需要 Spring sleuth?

】当spring-cloud-starter-zipkin使用zipkin.brave时,为啥需要Springsleuth?【英文标题】:whyneedSpringsleuthwhenspring-cloud-starter-zipkinuseszipkin.brave?当spring-cloud-starter-zipkin使用zipkin.brave时,为什么需要Springsleuth?【发布时间】:2021-10-2520:52 查看详情

链路追踪--sleuth和日志聚合---zipkin(代码片段)

...问题的是哪一台服务器中的那个微服务。如何使用第一步添加依赖<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-sleuth</artifactId></dependency>进行访问测试,日志打印内容改变࿰... 查看详情

springcloud学习之sleuth+zipkin

一、什么是Sleuth  为服务之间调用提供链路追踪。通过Sleuth可以很清楚的了解到一个服务请求经过了哪些服务,每个服务处理花费了多长。从而让我们可以很方便的理清各微服务间的调用关系。二、Sleuth作用  2.1:耗时分析... 查看详情

sleuth+zipkin实现springcloud链路追踪(代码片段)

文章目录一、前言二、应用架构图三、快速了解Sleuth四、准备工作1、搭建Zipkin单机环境2、搭建naocos单机环境五、微服务整合Sleuth1、创建SpringBoot工程2、配置文件3、实现核心代码六、集成Zipkin1、引入客户端2、配置文件3、运行效... 查看详情

springcloudalibaba(15)---sleuth+zipkin(代码片段)

SpringCloudAlibaba整合Sleuth+Zipkin有关Sleuth之前有写过两篇文章SpringCloudAlibaba(13)---Sleuth概述SpringCloudAlibaba(14)---SpringCloudAlibaba整合Sleuth上篇文章我们通过打印日志的方式,看到一个请求的完整链路。但是当微服务越来越多日志文件也会... 查看详情

java之springcloud微服务的链路追踪sleuth和zipkin(第三个阶段)springboot项目实现商品服务器端是调用(代码片段)

...kinServer下载与启动三、客户端Zipkin+Sleuth整合1、客户端添加依赖2、修改客户端配置文件3、重新启动运行测试四、Zipkin服务端数据保存到mysql1、准备MYSQL数据库和表(官方提供好的)2、修改server的启动命令五、基于消息... 查看详情

springcloud微服务分布式链路跟踪sleuth与zipkin

Zipkin是一个开放源代码分布式的跟踪系统,由Twitter公司开源,它致力于收集服务的定时数据,以解决微服务架构中的延迟问题,包括数据的收集、存储、查找和展现。它的理论模型来自于GoogleDapper论文。每个微服务向Zipkin报告... 查看详情

springcloud(16)——链路追踪工具sleuth(代码片段)

追踪工具SleuthSpringCloudSleuth可以用来追踪微服务请求中的整个请求,通过它可以记录各个请求之间的耗时、异常等情况。使用SpringCloudSleuth时一般会跟Zipkin一起使用。SpringCloudSleuth收集到的一些跟踪信息可以发送给Zipkin,Zipkin提供... 查看详情

springcloud整合分布式链路追踪系统sleuth和zipkin实战,分析系统瓶颈

...微服务架构中系统调用的瓶颈问题~SpringCloud链路追踪组件Sleuth实战官网  主要功能:做日志埋点什么是Sleuth  专门用于追踪每个请求的完整调用链路。  例如:【order-service,f674cc8 查看详情

config,bus,stream,sleuth+zipkin详解(代码片段)

一、Config分布式配置中心1.概述SpringCloudConfig解决了在分布式场景下多环境配置文件的管理和维护。好处:集中管理配置文件不同环境不同配置,动态化的配置更新配置信息改变时,不需要重启即可更新配置信息到服... 查看详情

引入sleuth依赖导致websocket发送stomp消息失败(代码片段)

引入sleuth依赖websocket发送STOMP消息失败添加了sleuth和zipkin之后,报下面这个错误,这个问题找了好久终于解决需要添加sleuth配置通过以下方式禁用侦探的websocket消息传递支持spring.sleuth.integration.websockets.enabled=false具体参... 查看详情

Spring Sleuth 卡住了向 Zipkin 发送 10% 的请求

】SpringSleuth卡住了向Zipkin发送10%的请求【英文标题】:SpringSleuthstucksending10percentofrequesttoZipkin【发布时间】:2018-08-1708:50:00【问题描述】:默认情况下,SpringSleuth只向Zipkin发送10%的请求。通过设置spring.sleuth.sampler.percentage,您可... 查看详情

springcloud分布式链路跟踪sleuth+zipkin+elasticsear

随着业务越来越复杂,系统也随之进行各种拆分,特别是随着微服务架构的兴起,看似一个简单的应用,后台可能很多服务在支撑;一个请求可能需要多个服务的调用;当请求迟缓或不可用时,无法得知是哪个微服务引起的,这... 查看详情

springcloud分布式链路跟踪sleuth+zipkin+elasticsear

随着业务越来越复杂,系统也随之进行各种拆分,特别是随着微服务架构的兴起,看似一个简单的应用,后台可能很多服务在支撑;一个请求可能需要多个服务的调用;当请求迟缓或不可用时,无法得知是哪个微服务引起的,这... 查看详情

从零搭建一个springcloud项目之sleuth+zipkin(代码片段)

在需要加监控的服务上进行以下操作一、加入Sleuth加依赖<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-sleuth</artifactId></dependency>二、加入Zipkin2.1使 查看详情

day441.sleuth链路追踪+zipkin分析-谷粒商城(代码片段)

Sleuth链路追踪+Zipkin分析一、为什么要用微服务架构是一个分布式架构,它按业务划分服务单元,一个分布式系统往往有很多个服务单元。由于服务单元数量众多,业务的复杂程度不同,如果出现了错误和异常&#... 查看详情

sleuth+zipkin服务链路追踪(代码片段)

...方文档:https://cloud.spring.io/spring-cloud-static/spring-cloud-sleuth/2.1.3.RELEASE/single/spring-cloud-sleuth.html一、为什么要用链路追踪微服务架构是一个分布式架构,它按业务划分服务单元,一个分布式系统往往有很多个服务单元。... 查看详情