IDEA启动正常debug启动报错

169 阅读1分钟

项目场景:

很奇怪的一个问题,项目运行正常,debug启动直接报错,运行不起来

Exception in thread "main" 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:355)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:304)
	at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
FATAL ERROR in native method: processing of -javaagent failed
Disconnected from the target VM, address: '127.0.0.1:52865', transport: 'socket'

原因分析:

看错误分析问题:

  1. kotlinx 没有安装,新版本用kotlinx语言
  2. jdk路径不正确或未正确配置
  3. 启动类vm各种参数添加尝试

开始一个一个实验,都以失败告终,因为正常run是可以启动的,其实这些东西应该都是正确的


解决方案:

idea的设置中Debugger配置中的启用一个参数,:

Kotlin:

  • Disable coroutine agent

似乎是默认启用了携程代理,禁用之后就恢复正常了

本文转自 jimolvxing.blog.csdn.net/article/det…,如有侵权,请联系删除。