SpringBoot2.1.7引入Minio8.5.0报错The following method did not exit: kotlin.collections.ArraysKt.copyInto

项目是一个SpringBoot2.1.7,使用Minio的Java SDK所触发的完整的报错信息如下:

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    okio.Segment.writeTo(Segment.kt:169)

The following method did not exist:

    kotlin.collections.ArraysKt.copyInto([B[BIII)[B

The method's class, kotlin.collections.ArraysKt, is available from the following locations:

    jar:file:/Users/houchengwei/maven/repository/org/jetbrains/kotlin/kotlin-stdlib/1.2.71/kotlin-stdlib-1.2.71.jar!/kotlin/collections/ArraysKt.class

It was loaded from the following location:

    file:/Users/houchengwei/maven/repository/org/jetbrains/kotlin/kotlin-stdlib/1.2.71/kotlin-stdlib-1.2.71.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of kotlin.collections.ArraysKt

报错的原因

通过报错的描述得知程序调用了一个位于kotlin-stdlib包中的一个不存在的方法kotlin.collections.ArraysKt.copyInto,该方法是kotlin-stdlib 1.3才出现的。

在这里插入图片描述

通过SpringBoot2.1.7的spring-boot-denedencies文件找到了定义kotlin-stdlib所用的版本号为1.2.71。
在这里插入图片描述
由于kotlin-stdlib在项目中作为传递依赖,而<dependencyManagement>又控制了传递依赖的版本,这就导致项目中的kotlin-stdlib的版本被确定成这个1.2.71,该包内没有copyInto方法,导致程序运行时报错。

解决问题

我们通过直接依赖kotlin-stdlib的方式使项目引入正确版本的kotlin-stdlib包(在项目中的pom.xml的<dependencies>标签内添加下面的依赖即可):

<dependency>
  <groupId>org.jetbrains.kotlin</groupId>
  <artifactId>kotlin-stdlib</artifactId>
  <version>1.8.21</version>
</dependency>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值