kotlin-debug-adapter
kotlin-debug-adapter copied to clipboard
NoClassDefFound when trying to debug using default generated launch.json
Using Ktor web server with the following main
@UseExperimental(KtorExperimentalAPI::class)
fun main(args: Array<String>) {
val server = embeddedServer(CIO, 8080, module = Application::module)
server.start(wait = true)
}

@Strum355 I've transferred the issue to kotlin-debug-adapter, since that is where the debug functionality is implemented.
This looks like a bug with the dependency resolution. Did you run a ./gradlew build before starting the debug session?
For reproduce this bug :
- mkdir abc && cd abc
- gradle init (select application-kotlin-kotlin-dsl)
- ./gradlew build
- open VSCode and run debbuger; (not forget change class name) And....we have the bug
What we can do? If replace implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") to implementation("org.jetbrains.kotlin:kotlin-stdlib") it can help.
info
------------------------------------------------------------
Gradle 5.6.2
------------------------------------------------------------
Build time: 2019-09-05 16:13:54 UTC
Revision: 55a5e53d855db8fc7b0e494412fc624051a8e781
Kotlin: 1.3.41
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.14 compiled on March 12 2019
JVM: 1.8.0_201 (Oracle Corporation 25.201-b09)
OS: Linux 5.1.16-050116-generic amd64
Any update on this?
It seems to me that changing this line to implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' will fix the issue.
I'm reproducing this issue with the following configuration, it might be related to ktor ? 🤔
plugins {
id 'org.jetbrains.kotlin.jvm' version "$kotlin_version"
id 'application'
}
mainClassName = 'io.ktor.server.netty.EngineMain' // Starting with 1.0.0-beta-3
sourceCompatibility = 1.8
targetCompatibility = 1.8
compileKotlin { kotlinOptions.jvmTarget = "1.8" }
compileTestKotlin { kotlinOptions.jvmTarget = "1.8" }
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "io.ktor:ktor-server-netty:$ktor_version"
compile "ch.qos.logback:logback-classic:1.2.3"
testCompile group: 'junit', name: 'junit', version: '4.12'
}
sourceSets {
main.kotlin.srcDirs = [ 'src/main/kotlin' ]
main.resources.srcDirs = [ 'src/main/resources' ]
}
Update: I seemed to fix the NoClassDefFound by using JDK 8