【问题标题】:Upgrading to Spring Boot 2.5.12 and am getting this error - possible dependency issue升级到 Spring Boot 2.5.12 并收到此错误 - 可能存在依赖问题
【发布时间】:2022-08-17 01:19:27
【问题描述】:

这是我的POM 文件,我已在其中升级到 Spring Boot 2.5.12。我需要更新或添加任何其他依赖项吗?

    
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-core</artifactId>
            <version>3.3.22.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-boot-starter</artifactId>
            <version>${swagger.version}</version>
        </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>io.strati.tunr.utils</groupId>
            <artifactId>strati-af-tunr-utils-client-spring</artifactId>
            <version>${ccm.client.version}</version>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1</version>
        </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.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>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-kubernetes-config</artifactId>
            <version>1.1.2.RELEASE</version>
        </dependency>
       
        <dependency>
            <groupId>com.openpojo</groupId>
            <artifactId>openpojo</artifactId>
            <version>0.8.3</version>
            <scope>test</scope>
        </dependency>
        </dependency>
    </dependencies>
        <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>
</project>

运行时出现此问题

引起:java.lang.ClassNotFoundException:
reactor.util.context.ContextView 在
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)

java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
在 java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 87 更多

  • 请不要通过删除太多内容来破坏您的帖子,以至于答案不再有意义。
  • 不得不编辑一些信息 - 为此提出了一个标志并正在等待状态 - 已经相应地再次编辑了帖子......
  • 如果问题是关于运行单元测试,那么 pom 应该真的运行单元测试,否则你会得到 cmets 和答案,说那是缺失的,那是你的问题。您需要在此处留下minimal reproducible example,这是您最初拥有的 - 至少它是可重现的。
  • 只有版主can assist you with that
  • 这是a meta question的主题之一。 The other one 已删除。

标签: java spring-boot


【解决方案1】:

您需要更新此依赖项:

        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-core</artifactId>
            <version>3.3.22.RELEASE</version>
        </dependency>

到版本 3.4.x 作为 Spring Boot 2.5.12 使用反应堆.netty1.0.18 依赖于反应堆核心3.4.x(与NoClassDefFoundError for reactor.util.context.ContextView using an HttpClient with reactor-netty-core and reactor-netty-http #1388),但您强制 Maven 使用较旧的反应堆核心版本。

【讨论】:

    猜你喜欢
    • 2022-08-09
    • 1970-01-01
    • 1970-01-01
    • 2017-01-10
    • 2021-08-13
    • 1970-01-01
    • 1970-01-01
    • 2017-08-03
    • 2017-01-13
    相关资源
    最近更新 更多