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

我正在升级到Spring启动2.5.12,并在下面得到这个错误

常智勇
2023-03-14

这是pom文件,我在某处读到它可能是spring coud依赖性问题?我还可以看到,在错误输出中,这可能与spring core有关。

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.12</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.sams.pricing</groupId>
    <artifactId>pricing-rules-mediator-api</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>pricing-rules-mediator-api</name>
    <description>Pricing rules mediator API for event based system</description>
    <properties>
        <java.version>11</java.version>
        <jacoco.version>0.8.7</jacoco.version>
        <sonar-jacoco-listeners.version>3.8</sonar-jacoco-listeners.version>
        <sonar.language>java</sonar.language>
        <sonar.sourceEncoding>UTF-8</sonar.sourceEncoding>
        <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
        <coverage.reports>${project.build.directory}/coverage-reports</coverage.reports>
        <jacoco.out.ut.file>${coverage.reports}/jacoco-ut.exec</jacoco.out.ut.file>
        <jacoco.out.it.file>${coverage.reports}/jacoco-it.exec</jacoco.out.it.file>
        <jacoco.out.merged.file>${coverage.reports}/merged-report.exec</jacoco.out.merged.file>
        <sonar.jacoco.itReportPaths>${coverage.reports}/jacoco-it.exec</sonar.jacoco.itReportPaths>
        <sonar.coverage.jacoco.xmlReportPaths>${coverage.reports}/coverage-report-merged/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
        <pricing-commons.version>1.2.3</pricing-commons.version>
        <swagger.version>3.0.0</swagger.version>
        <mockwebserver.version>4.7.2</mockwebserver.version>
        <event-horizon.version>2.0.20</event-horizon.version>
        <pricing-execution-common.version>1.0.1</pricing-execution-common.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.retry</groupId>
            <artifactId>spring-retry</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>com.sams.event.horizon</groupId>
            <artifactId>evclient</artifactId>
            <version>2.0.20</version>
        </dependency>
        <dependency>
            <groupId>com.sams.pricing</groupId>
            <artifactId>commons</artifactId>
            <version>${pricing-commons.version}</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-kubernetes-config</artifactId>
            <version>1.1.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.sams.pricing</groupId>
            <artifactId>pricing-execution-commons</artifactId>
            <version>${pricing-execution-common.version}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-boot-starter</artifactId>
            <version>${swagger.version}</version>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>mockwebserver</artifactId>
            <version>${mockwebserver.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>${mockwebserver.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mock-server</groupId>
            <artifactId>mockserver-netty</artifactId>
            <version>RELEASE</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>build-info</id>
                        <goals>
                            <goal>build-info</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <forkCount>3C</forkCount><!--Number of parallel JVM = 3 times the number
                of available processors -->
                    <reuseForks>true</reuseForks>
                    <testFailureIgnore>false</testFailureIgnore>
                    <argLine>${surefireArgLine}</argLine>
                    <includes>
                        <include>**/*Test*</include>
                    </includes>
                    <excludes>
                        <exclude>**/FT/**</exclude>
                        <exclude>**/*IT*</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>1.18.12</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
                <executions>
                    <execution>
                        <id>run-annotation-processors-only</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <compilerArgument>-proc:only</compilerArgument>
                        </configuration>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <updateDependencies>true</updateDependencies>
                    <localCheckout>true</localCheckout>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <configuration>
                    <propertyName>coverageAgent</propertyName>
                    <append>true</append>
                </configuration>
                <executions>
                    <execution>
                        <id>pre-unit-test</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                             <destFile>${coverage.reports}/jacoco-ut.exec</destFile>
                            <propertyName>surefireArgLine</propertyName>
                            <append>true</append>
                        </configuration>
                    </execution>
                    <execution>
                        <id>post-unit-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <dataFile>${coverage.reports}/jacoco-ut.exec</dataFile>
                            <outputDirectory>${coverage.reports}/coverageReport</outputDirectory>
                            <append>true</append>
                        </configuration>
                    </execution>
                    <execution>
                        <id>pre-integration-test</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <destFile>${coverage.reports}/jacoco-it.exec</destFile>
                            <propertyName>failsafeArgLine</propertyName>
                        </configuration>
                    </execution>
                    <execution>
                        <id>post-integration-test</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                        <append>true</append>
                            <dataFile>${coverage.reports}/jacoco-it.exec</dataFile>
                            <outputDirectory>${coverage.reports}/coverageReport</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>merge-unit-and-integration</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>merge</goal>
                        </goals>
                        <configuration>
                            <fileSets>
                                <fileSet>
                                    <directory>${coverage.reports}</directory>
                                    <includes>
                                        <include>*.exec</include>
                                    </includes>
                                </fileSet>
                            </fileSets>
                            <destFile>${jacoco.out.merged.file}</destFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>merge-reports</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <dataFile>${jacoco.out.merged.file}</dataFile>
                            <outputDirectory>${coverage.reports}/coverage-report-merged</outputDirectory>
                        </configuration>
                    </execution>
                    <!-- Line coverage plugin -->
                    <execution>
                        <id>coverage-check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <dataFile>${jacoco.out.merged.file}</dataFile>
                            <rules>
                                <rule>
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit>
                                            <counter>LINE</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0.50</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <distributionManagement>
        <snapshotRepository>
            <id>pangaea_snapshots</id>
            <url>https://gec-maven-nexus.walmart.com/nexus/content/repositories/pangaea_snapshots
            </url>
        </snapshotRepository>
        <repository>
            <id>pangaea_releases</id>
            <url>https://gec-maven-nexus.walmart.com/nexus/content/repositories/pangaea_releases
            </url>
        </repository>
    </distributionManagement>


</project>

这是我在尝试运行应用程序时遇到的错误。

. ~[类/:na]由:java引起。lang.IllegalStateException:未能从类加载器jdk.internal.loader.ClassLoaders中内省类[org.springframework.cloud.context.properties.ConfigurationPropertiesBeans]$AppClassLoader@368239c8]位于组织。springframework。util。反射率TILS。org上的getDeclaredMethods(ReflectionUtils.java:485)~[spring-core-5.3.18.jar:5.3.18]。springframework。util。反射率TILS。doWithLocalMethods(ReflectionUtils.java:321)~[spring-core-5.3.18.jar:5.3.18]位于org。springframework。orm。jpa。支持PersistenceAnnotationBeanPostProcessor。org上的buildPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:417)~[spring-orm-5.3.18.jar:5.3.18]。springframework。orm。jpa。支持PersistenceAnnotationBeanPostProcessor。在org上查找持久性元数据(PersistenceAnnotationBeanPostProcessor.java:388)~[spring-orm-5.3.18.jar:5.3.18]。springframework。orm。jpa。支持PersistenceAnnotationBeanPostProcessor。org上的postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:335)~(spring-orm-5.3.18.jar:5.3.18)。springframework。豆。工厂支持AbstractAutowireCapableBeanFactory。applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1116)~(spring-beans-5.3.18.jar:5.3.18)位于org。springframework。豆。工厂支持AbstractAutowireCapableBeanFactory。doCreateBean(AbstractAutowireCapableBeanFactory.java:594)~[spring-beans-5.3.18.jar:5.3.18]。。。由于以下原因,省略了30个公共帧:java。lang.NoClassDefFoundError:org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata at java。基本/java。lang.Class。java上的getDeclaredMethods0(本机方法)~[na:na]。基本/java。lang.Class。privateGetDeclaredMethods(Class.java:3166)~[na:na]at java。基本/java。lang.Class。getDeclaredMethods(Class.java:2309)~[na:na]位于org。springframework。util。反射率TILS。getDeclaredMethods(ReflectionUtils.java:467)~[spring-core-5.3.18.jar:5.3.18]。。。java导致36个公共帧被省略。lang.ClassNotFoundException:组织。springframework。靴子上下文属性。java上的ConfigurationBeanFactoryMetadata。基本/jdk。内部的装载机。内置ClassLoader。loadClass(buildinclassloader.java:581)~[na:na]位于java。基本/jdk。内部的装载机。ClassLoaders$AppClassLoader。loadClass(ClassLoaders.java:178)~[na:na]在java。基本/java。lang.ClassLoader。loadClass(ClassLoader.java:521)~[na:na]

共有1个答案

楚嘉纳
2023-03-14

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

编辑:您可以使用

<spring-cloud.version>2020.0.5</spring-cloud.version>

根据https://spring.io/projects/spring-cloud

 类似资料: