更正应用程序的类路径,使其包含类BootstrapApplicationListener和SpringApplicationBuilder的兼容版本

vbopmzt1  于 2023-03-02  发布在  Spring
关注(0)|答案(1)|浏览(175)

我正在尝试将我的springboot应用程序从.1.5.22升级到2.7.0。我还没有升级,因为有一些依赖性错误。我也在使用spring consult,因为这可能是错误。下面是我的pom.xml的一部分:

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.0</version>
        <relativePath />
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
        <testutils.version>1.6.1</testutils.version>
        <slf4j.version>1.7.25</slf4j.version>
        <logstash-logback-encoder.version>4.11</logstash-logback-encoder.version>
        <ch-qos-logback.version>1.2.11</ch-qos-logback.version>
        <!-- Sonar Properties -->
        <sonar.dynamicAnalysis>true</sonar.dynamicAnalysis>
        <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
        <sonar.language>java</sonar.language>
        <sonar.coverage.exclusions>**/*Config.*</sonar.coverage.exclusions>
        <log4j2.version>2.17.2</log4j2.version>
        <groovy.version>2.5.16</groovy.version>
        <httpclient.version>4.5.13</httpclient.version>
        <commons-beanutils.version>1.9.4</commons-beanutils.version>
        <gson.version>2.9.0</gson.version>
        <jackson.version>2.13.2</jackson.version>
        <snakeyaml.version>1.30</snakeyaml.version>
        <gemfire.version>8.1.0</gemfire.version>
        <hibernate.version>4.3.11.Final</hibernate.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.ws</groupId>
            <artifactId>spring-xml</artifactId>
            <version>3.1.3</version>
        </dependency>
        <dependency>
            <groupId>com.cdk.credit</groupId>
            <artifactId>credit-application-model</artifactId>
            <version>1.0.1</version>
        </dependency>
        <dependency>
            <groupId>com.cdk.ds.credit</groupId>
            <artifactId>dealer</artifactId>
            <version>2.0.24</version>
        </dependency>
        <dependency>
            <groupId>com.cdk.ds.credit</groupId>
            <artifactId>transaction-entities</artifactId>
            <version>1.3.8</version>
            <exclusions>
                <exclusion>
                    <artifactId>hibernate-jpa-2.0-api</artifactId>
                    <groupId>org.hibernate.javax.persistence</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.cdk.ds.credit</groupId>
            <artifactId>logging</artifactId>
            <version>1.0.7</version>
            <exclusions>
                <exclusion>
                    <artifactId>hibernate-jpa-2.1-api</artifactId>
                    <groupId>org.hibernate.javax.persistence</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.cdk.credit.memcache</groupId>
            <artifactId>cdk-credit-memcache</artifactId>
            <version>1.0.4</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.11.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.security</groupId>
            <artifactId>xml-security-impl</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.1.0.Final</version>
        </dependency>
        <dependency>
            <groupId>postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>9.1-901.jdbc4</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.1-api</artifactId>
            <version>1.0.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
        </dependency>

        <dependency>
            <groupId>com.googlecode.junit-toolbox</groupId>
            <artifactId>junit-toolbox</artifactId>
            <version>1.8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.jayway.restassured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>2.7.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.jayway.jsonpath</groupId>
            <artifactId>json-path</artifactId>
            <version>2.6.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.jayway.jsonpath</groupId>
            <artifactId>json-path-assert</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.easymock</groupId>
            <artifactId>easymock</artifactId>
            <version>3.2</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-consul-all</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>com.adp.ds.frontoffice.credit</groupId>
            <artifactId>testutils</artifactId>
            <version>${testutils.version}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${ch-qos-logback.version}</version>
        </dependency>
        <dependency>
            <groupId>com.cdk.credit.security</groupId>
            <artifactId>cdk-credit-security</artifactId>
            <version>1.0.1</version>
        </dependency>
        <dependency>
            <groupId>com.cdk.credit.error.response</groupId>
            <artifactId>cdk-credit-error-response</artifactId>
            <version>1.0.1</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.5.0-b01</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>${ch-qos-logback.version}</version>
        </dependency>
        <dependency>
            <groupId>net.logstash.logback</groupId>
            <artifactId>logstash-logback-encoder</artifactId>
            <version>${logstash-logback-encoder.version}</version>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>RELEASE</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.xmlunit</groupId>
            <artifactId>xmlunit-core</artifactId>
            <version>2.6.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jdom</groupId>
            <artifactId>jdom2</artifactId>
            <version>2.0.6.1</version>
        </dependency>
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.14.3</version>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-consul-dependencies</artifactId>
                <version>3.1.1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcprov-jdk15on</artifactId>
                <version>1.70</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>2.13.3</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>2.13.3</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
                <version>2.13.3</version>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-buffer</artifactId>
                <version>4.1.77.Final</version>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-transport</artifactId>
                <version>4.1.77.Final</version>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-transport-native-epoll</artifactId>
                <version>4.1.77.Final</version>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-codec</artifactId>
                <version>4.1.77.Final</version>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-codec-http</artifactId>
                <version>4.1.77.Final</version>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-common</artifactId>
                <version>4.1.77.Final</version>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-handler</artifactId>
                <version>4.1.77.Final</version>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>31.1-jre</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-crypto</artifactId>
                <version>5.7.1</version>
            </dependency>

        </dependencies>
    </dependencyManagement>
    • 以下是错误:**

应用程序无法启动
描述:
试图调用不存在的方法。尝试是从以下位置进行的:

org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:120)

以下方法不存在:

org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;)V

调用方法的类org.springframework. cloud. bootstrap. BootstrapApplicationListener已从以下位置加载:

jar:file:/Users/patangav/.m2/repository/org/springframework/cloud/spring-cloud-context/1.1.0.RELEASE/spring-cloud-context-1.1.0.RELEASE.jar!/org/springframework/cloud/bootstrap/BootstrapApplicationListener.class

被调用方法的类org.springframework. boot. builder. SpringApplicationBuilder可从以下位置获得:

jar:file:/Users/patangav/.m2/repository/org/springframework/boot/spring-boot/2.7.0/spring-boot-2.7.0.jar!/org/springframework/boot/builder/SpringApplicationBuilder.class

被调用方法的类层次结构是从以下位置加载的:

org.springframework.boot.builder.SpringApplicationBuilder: file:/Users/patangav/.m2/repository/org/springframework/boot/spring-boot/2.7.0/spring-boot-2.7.0.jar

行动:
更正应用程序的类路径,使其包含类org. springframework. cloud. bootstrap. BootstrapApplicationListener和org. springframework. boot. builder. SpringApplicationBuilder的兼容版本

prdp8dxp

prdp8dxp1#

错误显示:调用方法的类org.springframework. cloud. bootstrap. BootstrapApplicationListener已从以下位置加载:
jar:file:/Users/patangav/.m2/repository/org/springframework/cloud/spring-cloud-context/1.1.0.RELEASE/spring-cloud-context-1.1.0.RELEASE.jar!/org/springframework/cloud/bootstrap/BootstrapApplicationListener.class
=〉Spring-云-上下文/1.1.0.版本
您的pom.xml引用:

<artifactId>spring-cloud-consul-dependencies</artifactId>
<version>3.1.1</version>

因此,您应该使用最新的spring-cloud-context版本:https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-context
您的pom.xml看起来一致。请尝试清理/重新生成,如果可能,请删除IDE缓存。
如果错误仍然发生,使用mvn dependency:tree命令找出为什么您仍然使用1.1.0版本的spring-cloud-context库。

相关问题