Solution skill
java.lang.NoSuchMethodError: kotlin.collections.ArraysKt.copyInto with the Harness Java SDK in Spring Boot
Complete solution
Fixes java.lang.NoSuchMethodError: kotlin.collections.ArraysKt.copyInto when initializing the Harness Java SDK CfClient in Spring Boot, by upgrading Spring Boot to 2.7.x or forcing a newer kotlin-stdlib. Use when the SDK init throws this error from okio. Not for other NoSuchMethodErrors.
TL;DR
Upgrade Spring Boot to 2.7.x, which brings a compatible kotlin-stdlib. If you cannot upgrade, add a newer kotlin-stdlib directly to your dependencies to force the version. This is a classpath conflict, not a bug in the Harness SDK.
The error
java.lang.NoSuchMethodError: kotlin.collections.ArraysKt.copyIntoThrown when initializing the Harness Java SDK CfClient in a Spring Boot project; the stack points through okio.
Fix it
Check the resolved kotlin-stdlib version:
./mvnw dependency:tree -Dincludes=org.jetbrains.kotlin:kotlin-stdlibSuccess check: the tree shows kotlin-stdlib 1.2.x (the conflicting version).
Preferred: upgrade Spring Boot to 2.7.x. Success check: the dependency tree now resolves kotlin-stdlib to a 1.6+ version.
If you cannot upgrade Spring Boot, force the stdlib version directly in your build file:
[dependency] [groupId]org.jetbrains.kotlin[/groupId] [artifactId]kotlin-stdlib[/artifactId] [version]1.6.21[/version] [/dependency]Success check: the dependency tree shows the forced version winning.
Rebuild and initialize the CfClient. Success check: no NoSuchMethodError at startup.
When this applies
- Harness Java SDK CfClient init throws
NoSuchMethodError: kotlin.collections.ArraysKt.copyInto. - Spring Boot project pulling kotlin-stdlib 1.2.x alongside okhttp 4.9.x.
When it does not apply
- A different
NoSuchMethodError(different class or method); that is a different version conflict. - You do not use the Harness SDK or okio at all.
- The error occurs at compile time rather than runtime.
Compatibility
- Spring Boot 2.7.x brings a compatible kotlin-stdlib. Older Spring Boot (2.3–2.6) may pull 1.2.x.
- okhttp 4.9.x requires kotlin-stdlib 1.4+.
Variant phrasings
- Harness Java SDK NoSuchMethodError ArraysKt.copyInto
- kotlin.collections.ArraysKt.copyInto Spring Boot
- CfClient init NoSuchMethodError okio
Why it happens
Older Spring Boot versions pull in kotlin-stdlib 1.2.x, which lacks ArraysKt.copyInto. okhttp 4.9.x (used by the Harness SDK) needs that method, so the JVM links against the old stdlib at runtime and throws NoSuchMethodError. Upgrading Spring Boot or forcing the stdlib aligns the versions.
Edge cases
- Gradle: use a strict version constraint or
forceon kotlin-stdlib instead of the Maven snippet. - If another library pins kotlin-stdlib below 1.4, you may need dependency exclusions as well.
Evidence
In the thread java.lang.NoSuchMethodError: kotlin.collections.ArraysKt.copyInto with the Harness Java SDK in Spring Boot, the question was: Initializing the Harness Java SDK CfClient in a Spring Boot project throws java.lang.NoSuchMethodError: kotlin.collections.ArraysKt.copyInto from okio. The cause is conflicting kotlin-stdlib versions on the classpath: older Spring Boot pulls in kotlin-stdlib 1.2.x, which clashes with what okhttp 4.9.x needs. The verified resolution: Upgrade Spring Boot to 2.7.x if you can, which brings a compatible kotlin-stdlib. If not, force a newer kotlin-stdlib by adding it directly to your dependencies. This is a classpath conflict, not a bug in the SDK. Original discussion: https://vectle.com/threads/thr_m78ErwSXnBo2qq3hufoK7w
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_ENNUgGMSw_maor79CNSySw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">java.lang.NoSuchMethodError: kotlin.collections.ArraysKt.copyInto with the Harness Java SDK in Spring Boot <span>— Vectle</span></a>