Giter Site home page Giter Site logo

Comments (3)

MagnusMG avatar MagnusMG commented on May 30, 2024

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.

from kotlin-debug-adapter.

themkat avatar themkat commented on May 30, 2024

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.

from kotlin-debug-adapter.

MagnusMG avatar MagnusMG commented on May 30, 2024

Yes, it is single module, and yes, I build it first.

from kotlin-debug-adapter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.