当前位置: 首页 > 知识库问答 >
问题:

运行spring boot应用程序时出现异常

农均
2023-03-14

当运行我的Spring启动应用程序时,启动时低于异常。不确定是什么依赖导致了这一点。

Spring启动版本-2.3.1 IDE-Intellij

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'braveHttpServerHandler' defined in class path resource [org/springframework/cloud/sleuth/autoconfig/brave/instrument/web/BraveHttpBridgeConfiguration.class]: Unsatisfied dependency expressed through method 'braveHttpServerHandler' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'httpTracing' defined in class path resource [org/springframework/cloud/sleuth/autoconfig/brave/instrument/web/BraveHttpConfiguration.class]: Unsatisfied dependency expressed through method 'httpTracing' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sleuthSkipPatternProvider' defined in class path resource [org/springframework/cloud/sleuth/autoconfig/instrument/web/SkipPatternConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.sleuth.instrument.web.SkipPatternProvider]: Factory method 'sleuthSkipPatternProvider' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties.getBasePath()Ljava/lang/String;
    

这是一个多模块maven项目。如果需要其他信息,请告诉我。

+- org.springframework.boot:spring-boot-starter:jar:2.3.1.RELEASE:compile
|  +- org.springframework.boot:spring-boot:jar:2.3.1.RELEASE:compile
|  +- org.springframework.boot:spring-boot-starter-logging:jar:2.3.1.RELEASE:compile
|  \- org.springframework:spring-core:jar:5.2.7.RELEASE:compile
|     \- org.springframework:spring-jcl:jar:5.2.7.RELEASE:compile
+- org.springframework.boot:spring-boot-starter-actuator:jar:2.5.2:compile
|  \- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.3.1.RELEASE:compile
|     \- org.springframework.boot:spring-boot-actuator:jar:2.3.1.RELEASE:compile
+- org.springframework.boot:spring-boot-starter-web:jar:2.3.1.RELEASE:compile
|  +- org.springframework.boot:spring-boot-starter-json:jar:2.3.1.RELEASE:compile
|  +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.3.1.RELEASE:compile
|  +- org.springframework:spring-web:jar:5.2.7.RELEASE:compile
|  |  \- org.springframework:spring-beans:jar:5.2.7.RELEASE:compile
|  \- org.springframework:spring-webmvc:jar:5.2.7.RELEASE:compile
|     +- org.springframework:spring-aop:jar:5.2.7.RELEASE:compile
|     \- org.springframework:spring-expression:jar:5.2.7.RELEASE:compile
+- org.springframework.boot:spring-boot-starter-test:jar:2.3.1.RELEASE:test
|  +- org.springframework.boot:spring-boot-test:jar:2.3.1.RELEASE:test
|  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.3.1.RELEASE:test
|  \- org.springframework:spring-test:jar:5.2.7.RELEASE:test
+- org.springframework.boot:spring-boot-autoconfigure:jar:2.3.1.RELEASE:compile
+- org.springframework.boot:spring-boot-configuration-processor:jar:2.3.1.RELEASE:compile (optional)
+- org.springframework.boot:spring-boot-starter-jersey:jar:2.3.1.RELEASE:compile
|  \- org.springframework.boot:spring-boot-starter-validation:jar:2.3.1.RELEASE:compile
+- org.springframework.data:spring-data-elasticsearch:jar:4.0.0.RELEASE:compile
|  +- org.springframework:spring-context:jar:5.2.7.RELEASE:compile
|  +- org.springframework:spring-tx:jar:5.2.7.RELEASE:compile
|  \- org.springframework.data:spring-data-commons:jar:2.3.1.RELEASE:compile
\- io.springfox:springfox-boot-starter:jar:3.0.0:compile
   +- org.springframework.plugin:spring-plugin-core:jar:2.0.0.RELEASE:compile
   \- org.springframework.plugin:spring-plugin-metadata:jar:2.0.0.RELEASE:compile

下面是我的父母pom.xml

4.0.0

<parent>
    <groupId>com.abnamro.coesd</groupId>
    <artifactId>master-pom</artifactId>
    <version>4.0.0</version>
</parent>

<groupId>com.abnamro.arsr</groupId>
<artifactId>document-search-new</artifactId>
<version>1.0.1-SNAPSHOT</version>
<name>document-search-new</name>
<description>Document Search Module</description>
<packaging>pom</packaging>

<modules>
    <module>common</module>
    <module>es</module>
    <module>earchive</module>
    <module>api</module>
</modules>

<properties>
    <java.source>11</java.source>
    <java.target>11</java.target>
    <compiler-plugin.version>3.8.1</compiler-plugin.version>
    <!--<spring.boot.version>2.5.0</spring.boot.version>-->
    <spring.boot.version>2.3.1.RELEASE</spring.boot.version>
    <spring.cloud.sleuth.version>3.0.4</spring.cloud.sleuth.version>
    <spring.cloud.circuit.breaker>1.0.4.RELEASE</spring.cloud.circuit.breaker>
    <lombok.version>1.18.20</lombok.version>
    <springdoc.openapi.ui.version>1.4.2</springdoc.openapi.ui.version>
    <dependency.commons.collections.version>4.4</dependency.commons.collections.version>
    <dependency.mapstruct.version>1.4.2.Final</dependency.mapstruct.version>
    <elasticsearch.version>7.9.3</elasticsearch.version>
    <surefire-plugin.version>3.0.0-M4</surefire-plugin.version>
    <failsafe-plugin.version>3.0.0-M5</failsafe-plugin.version>
    <commons.lang3.version>3.11</commons.lang3.version>
    <springfox-swagger2-version>3.0.0</springfox-swagger2-version>
    <joda-time-version>2.10.10</joda-time-version>
    <jakarta.validation.api.version>2.0.2</jakarta.validation.api.version>
    <mapstruct.version>1.4.2.Final</mapstruct.version>
    <mapstruct.processor.version>1.4.2.Final</mapstruct.processor.version>
    <jackson-core.version>2.10.2</jackson-core.version>
    <jackson-databind.version>2.10.2</jackson-databind.version>
    <dependency.junit.jupiter.version>5.8.0-M1</dependency.junit.jupiter.version>
    <javax.validation.version>2.0.1.Final</javax.validation.version>
</properties>
<dependencyManagement>
    <dependencies>

        <dependency>
            <artifactId>spring-boot-starter-parent</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>spring-boot-starter-logging</artifactId>
                    <groupId>org.springframework.boot</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
                    <groupId>org.springframework.boot</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>log4j-slf4j-impl</artifactId>
                    <groupId>org.apache.logging.log4j</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>xpp3_min</artifactId>
                    <groupId>xpp3</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>xmlpull</artifactId>
                    <groupId>xmlpull</groupId>
                </exclusion>
            </exclusions>
            <groupId>org.springframework.boot</groupId>
            <scope>import</scope>
            <type>pom</type>
            <version>${spring.boot.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>${spring.boot.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
       
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>2020.0.3</version>
            <type>pom</type>
            <scope>runtime</scope>
        </dependency>


        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-sleuth</artifactId>
            <version>${spring.cloud.sleuth.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-zipkin</artifactId>
            <version>2.2.8.RELEASE</version>
        </dependency>
    </dependencies>
</dependencyManagement>
<dependencies>

    <dependency>
        <artifactId>spring-boot-starter</artifactId>
        <groupId>org.springframework.boot</groupId>
        <version>${spring.boot.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
        <version>2.5.6</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>${spring.boot.version}</version>
        
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>

        </exclusions>
    </dependency>
    <dependency>
        <artifactId>spring-boot-starter-test</artifactId>
        <groupId>org.springframework.boot</groupId>
        <scope>test</scope>
        <version>${spring.boot.version}</version>
       
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-autoconfigure</artifactId>
        <version>${spring.boot.version}</version>
    </dependency>
    <dependency>
        <artifactId>spring-boot-configuration-processor</artifactId>
        <groupId>org.springframework.boot</groupId>
        <optional>true</optional>
        <version>${spring.boot.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jersey</artifactId>
        <version>${spring.boot.version}</version>
       
    </dependency>

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-elasticsearch</artifactId>
        <version>4.0.0.RELEASE</version>
        <exclusions>
            <exclusion>
                <groupId>org.elasticsearch</groupId>
                <artifactId>elasticsearch</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.elasticsearch</groupId>
                <artifactId>elasticsearch-core</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.elasticsearch.client</groupId>
                <artifactId>elasticsearch-rest-client</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.elasticsearch.client</groupId>
                <artifactId>
                    elasticsearch-rest-high-level-client
                </artifactId>
            </exclusion>
        </exclusions>
    </dependency>

     
    <!-- Uncomment for local usage.-->
    <!--<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
    </dependency>-->

    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>${lombok.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-ui</artifactId>
        <version>${springdoc.openapi.ui.version}</version>
        <classifier>javadoc</classifier>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-collections4</artifactId>
        <version>${dependency.commons.collections.version}</version>
    </dependency>

    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>${javax.validation.version}</version>
    </dependency>



    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <exclusions>
            <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>${commons.lang3.version}</version>
    </dependency>
    <dependency>
        <groupId>javax.enterprise</groupId>
        <artifactId>cdi-api</artifactId>
        <version>2.0</version>
        <scope>provided</scope>
    </dependency>
    
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-boot-starter</artifactId>
        <version>${springfox-swagger2-version}</version>
    </dependency>
    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>${joda-time-version}</version>
    </dependency>
    <dependency>
        <artifactId>jackson-core</artifactId>
        <groupId>com.fasterxml.jackson.core</groupId>
        <version>${jackson-core.version}</version>
    </dependency>
    <dependency>
        <artifactId>jackson-databind</artifactId>
        <groupId>com.fasterxml.jackson.core</groupId>
        <version>${jackson-databind.version}</version>
    </dependency>

    <dependency>
        <groupId>jakarta.validation</groupId>
        <artifactId>jakarta.validation-api</artifactId>
        <version>${jakarta.validation.api.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>${dependency.junit.jupiter.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.mapstruct</groupId>
        <artifactId>mapstruct</artifactId>
        <version>${dependency.mapstruct.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.mapstruct</groupId>
        <artifactId>mapstruct-processor</artifactId>
        <version>${dependency.mapstruct.version}</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <artifactId>core</artifactId>
        <groupId>com.abnamro.arsr</groupId>
        <version>0.0.26</version>
    </dependency>
</dependencies>

<build>
    <pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>${spring-boot-maven-plugin.version}</version>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-clean-plugin</artifactId>
            <version>${clean.plugin}</version>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>${dependency.plugin}</version>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${surefire-plugin.version}</version>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>${failsafe-plugin.version}</version>
        </plugin>
    </plugins>
    </pluginManagement>


       
       
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${compiler-plugin.version}</version>
            <!-- Use the following configurations to check if there is a failure in compilation -->
            <configuration>
                <source>${java.source}</source>
                <target>${java.target}</target>
                <annotationProcessorPaths>
                    <path>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok</artifactId>
                        <version>${lombok.version}</version>
                    </path>
                    <path>
                        <groupId>org.mapstruct</groupId>
                        <artifactId>mapstruct-processor</artifactId>
                        <version>${dependency.mapstruct.version}</version>
                    </path>
                </annotationProcessorPaths>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>${jacoco.plugin}</version>
            <configuration>
                <destFile>${sonar.jacoco.reportPaths}</destFile>
            </configuration>
            <executions>
                <execution>
                    <id>agent</id>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
                <execution>
                    <id>default-report</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

共有1个答案

范轶
2023-03-14

对于任何NoSuchMethodErrori(报价)打赌99:1-这是版本冲突!;)

错误消息与您的声明一致:

  • 使用spring boot:2.3.1。发布

这意味着有一些(Spring启动)组件

一个好的开始方式是(通过定位

mvn dependency:tree -Dincludes=org.springframework*

依赖:树文档/示例

(在netbean你可以尝试项目pom的图形视图)

更新:在您的情况下,它甚至可能不是类路径冲突,而是一个键为:management的属性。服务器基本路径(仅在“大约”2.4版本中引入)

 类似资料: