简体   繁体   English

当添加侦探和zipkin时,app无法启动

[英]app fails to start when sleuth and zipkin are added

I have a Spring Boot app that I'm updating to 1.5.1. 我有一个Spring Boot应用程序,我正在更新到1.5.1。 It works great, until I add Sleuth and Zipkin to classpath 它很棒,直到我将Sleuth和Zipkin添加到classpath

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

when these lines are present, I get 当这些线存在时,我明白了

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

This is my dep. 这是我的部门。 management 管理

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

I tried change to 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>

but the errors get even stranger 但错误变得更加奇怪

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

and

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

am I missing something I haven't noticed yet? 我错过了一些我还没注意到的东西吗?

I can't explain the error that you got with Dalston.BUILD-SNAPSHOT, but the error with Camden.SR4 is because it's not compatible with Spring Boot 1.5. 我无法解释你用Dalston.BUILD-SNAPSHOT得到的错误,但Camden.SR4的错误是因为它与Spring Boot 1.5不兼容。 I'd recommend upgrading to Camden.SR5 which is compatible with Spring Boot 1.5 . 我建议升级到与Spring Boot 1.5兼容的 Camden.SR5。

Even I got this error while setting up my project. 即使我在设置项目时遇到此错误。 I was using Spring boot 1.5.8 with the Brixton.SR6 release. 我使用Spring引导1.5.8和Brixton.SR6版本。 However, when I consulted the site http://projects.spring.io/spring-cloud/ I got to know the issue and I updated my dependency to Dalston.SR4 and then the application started working. 但是,当我咨询网站http://projects.spring.io/spring-cloud/时,我知道了这个问题,并将我的依赖关系更新为Dalston.SR4,然后应用程序开始工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM