首页 > 解决方案 > 如何在调试中修复 ClassNotFoundException: kotlinx.coroutines.debug.AgentPremain?

问题描述

我正在运行几个项目作为 Spring Boot 应用程序,其中一个特别无法启动并且正在抛出:

java.lang.ClassNotFoundException: kotlinx.coroutines.debug.AgentPremain
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:304)
    at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Exception in thread "main" FATAL ERROR in native method: processing of -javaagent failed
Disconnected from the target VM, address: '127.0.0.1:64279', transport: 'socket'

Process finished with exit code 1

命令行有以下选项:

-javaagent:[...].m2/repository/org/jetbrains/kotlinx/kotlinx-coroutines-core/1.5.0/kotlinx-coroutines-core-1.5.0.jar

而这个罐子是存在的。

这是在将我的 Intellij'Idea 更新到 2021.2 之后发生的

此问题仅在调试模式下发生。

知道如何解决这个问题吗?

标签: kotlinintellij-idea

解决方案


这是 Kotlin 插件中的一个已知问题。作为一种解决方法,禁用Settings/Preferences | Build, Execution, Deployment | Debugger | Data Views | Kotlin | enable "Disable coroutine agent".

请关注https://youtrack.jetbrains.com/issue/KTIJ-19345以获取更新。


推荐阅读