Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix ClassNotFoundException: kotlinx.coroutines.debug.AgentPremain in debug?

I am running several projects as spring boot applications, one of them specifically cannot start and is throwing:

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

The command line has the option:

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

And this jar exists.

this happened after updating my Intellij'Idea to 2021.2

This issue happens only in debug mode.

Any idea how to solve this?

like image 640
Léo Schneider Avatar asked Aug 12 '21 07:08

Léo Schneider


1 Answers

It is a known problem in the Kotlin plugin. As a workaround disable the coroutine agent option under Settings/Preferences | Build, Execution, Deployment | Debugger | Data Views | Kotlin | enable "Disable coroutine agent".

Please follow https://youtrack.jetbrains.com/issue/KTIJ-19345 , for updates.

enter image description here

like image 93
Egor Klepikov Avatar answered Nov 13 '22 04:11

Egor Klepikov