Open jmrsnt opened 1 year ago
I seem to be having the same problem: Could not resolve classpath using Gradle: ClassLoader.getSystemResourceAsStream(scriptName) must not be null
.
This happens as soon as I try to use an external library: I use the sample project for testing the debugger , and it works fine. If I add an external reference, I get the error.
[INFO] main Connected to client
[INFO] async1 Resolving dependencies for 'kotlin-quick-start' through Gradle's CLI using tasks [kotlinLSPProjectDeps]...
[WARN] async1 Could not resolve classpath using Gradle: ClassLoader.getSystemResourceAsStream(scriptName) must not be null
[INFO] async1 Successfully resolved kotlin-stdlib using Maven
[INFO] async1 Starting JVM debug session with main class quick.start.AppKt
Exception in thread "main" java.lang.NoClassDefFoundError: se/magnusgunnarsson/kutil/DBConnectionBuilder
at quick.start.AppKt.main(App.kt:17)
Caused by: java.lang.ClassNotFoundException: se.magnusgunnarsson.kutil.DBConnectionBuilder
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 1 more
[INFO] eventBus Sent exit event
[INFO] async0 Exiting JDI session
The project runs without problem when using ./gradlew run
.
Here is the kotlin code:
package quick.start
import java.io.File
import se.magnusgunnarsson.kutil.DBConnectionBuilder
class App {
val greeting: String
get() = "Hello world."
}
fun main(args: Array<String>) {
val conn = DBConnectionBuilder.createConnection( DBConnectionBuilder.DatabaseID.EUL_XGUMAG_TEST )
val qry = """
SELECT institution, year, OVERALL_SCORE_CALC AS score
FROM RANK_ARWU_OVERALL
WHERE country='Sweden'
ORDER BY institution, year
"""
val stmt = conn.createStatement()
val rs = stmt.executeQuery( qry )
while ( rs.next() ){
println( rs.getString(1) )
}
println(App().greeting)
}
I'm on Mac OS X 13.13.1, VSCode 1.77.3 and (to the best of my knowledge) openjdk 11.
Your projects are single module projects, right? Do you remember to actually build your projects before trying to debug? the debug adapter does not build anything for you, and depends on the files in the build
-directory. Tried both a Spring and Quarkus project again just now to verify that nothing is suddenly broken, and both work fine after running a ./gradlew build
first.
Yes, it is single module, and yes, I build it first.
Hi!
First of all, thanks for this project!
When launching Kotlin Debugger, this error appears:
Full Log:
It seems that it is not able to retrieve the list of dependencies and write to the temporary .gradle file, I verified that the
D:\Windows\Tmp\classpath18145152464469241149.gradle
file is empty.My project structure:
build.gradle.kts:
.vscode/launch.json: