fwcd / kotlin-debug-adapter

Kotlin/JVM debugging for any editor/IDE using the Debug Adapter Protocol
MIT License
110 stars 19 forks source link

Cannot Debug Quarkus Kotlin project #66

Open tuan1nguyen opened 1 year ago

tuan1nguyen commented 1 year ago

I got these errors in VS Code:

[ERROR] Caused by: com.sun.jdi.AbsentInformationException [ERROR] at jdk.jdi/com.sun.tools.jdi.ReferenceTypeImpl.baseSourceName(ReferenceTypeImpl.java:769) [ERROR] at jdk.jdi/com.sun.tools.jdi.ReferenceTypeImpl.baseSourcePath(ReferenceTypeImpl.java:777) [ERROR] at jdk.jdi/com.sun.tools.jdi.BaseLineInfo.liSourcePath(BaseLineInfo.java:57) [ERROR] at jdk.jdi/com.sun.tools.jdi.LocationImpl.sourcePath(LocationImpl.java:201) [ERROR] at jdk.jdi/com.sun.tools.jdi.LocationImpl.sourcePath(LocationImpl.java:196) [ERROR] at jdk.jdi/com.sun.tools.jdi.LocationImpl.sourcePath(LocationImpl.java:191) [ERROR] at org.javacs.ktda.jdi.JDIDebuggee.sourceOf(JDIDebuggee.kt:171) [ERROR] at org.javacs.ktda.jdi.JDIDebuggee.positionOf(JDIDebuggee.kt:167) [ERROR] at org.javacs.ktda.jdi.stack.JDIStackFrame.(JDIStackFrame.kt:19) [ERROR] at org.javacs.ktda.jdi.stack.JDIStackTrace.(JDIStackTrace.kt:11) [ERROR] at org.javacs.ktda.jdi.JDIThread.stackTrace(JDIThread.kt:35) [ERROR] at org.javacs.ktda.jdi.JDIThread.stackTrace(JDIThread.kt:14) [ERROR] at org.javacs.ktda.adapter.KotlinDebugAdapter.stackTrace(KotlinDebugAdapter.kt:348)

launch.json

{ "version": "0.2.0", "configurations": [ { "preLaunchTask": "quarkusDev", "type": "kotlin", "request": "attach", "projectRoot": "${workspaceFolder}", "hostName": "localhost", "name": "Debug Quarkus application", "timeout": 30000, "port": 5005 } ] }

openjdk 17.0.5 2022-10-18 OpenJDK Runtime Environment Temurin-17.0.5+8 (build 17.0.5+8) OpenJDK 64-Bit Server VM Temurin-17.0.5+8 (build 17.0.5+8, mixed mode, sharing)

themkat commented 1 year ago

Are you sure Quarkus dev mode is starting? I tried doing the following now:

Tried this with both VSCode and Emacs (using dap-kotlin), and both works like a charm. Maybe quarkus dev isn't started properly? (what does the task quarkusDev look like?). Could you try starting it manually instead of as a prelaunchtask? Or maybe its the build files mentioned? (maybe try doing a gradle build?)

pF-luis commented 1 year ago

got the exact same issue, also when using a completely new quarkus+gradle+kotlin project. I've only added the launch json, build the project and run the project using gradle and the quarkus cli.

The Debugger is actually halting, it's just not showing where. Also, i am able to step through the correct number of breakpoints as it seems, it's just not displayed within the editor gui. The only thing I am able to see within the debug view is the debug console which has the stacktrace output and the Callstack view which displays this "internal error" instead of the backtrace and/or stackframes image

This is my full stacktrace:

[ERROR] server    Internal error: java.lang.reflect.InvocationTargetException
[ERROR] java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
[ERROR]     at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67)
[ERROR]     at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
[ERROR]     at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
[ERROR]     at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
[ERROR]     at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
[ERROR]     at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
[ERROR]     at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
[ERROR]     at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
[ERROR]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[ERROR]     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[ERROR]     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[ERROR]     at java.base/java.lang.Thread.run(Thread.java:833)
[ERROR] Caused by: java.lang.reflect.InvocationTargetException
[ERROR]     at jdk.internal.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[ERROR]     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]     at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[ERROR]     at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
[ERROR]     ... 11 more
[ERROR] Caused by: com.sun.jdi.AbsentInformationException
[ERROR]     at jdk.jdi/com.sun.tools.jdi.ReferenceTypeImpl.baseSourceName(ReferenceTypeImpl.java:769)
[ERROR]     at jdk.jdi/com.sun.tools.jdi.ReferenceTypeImpl.baseSourcePath(ReferenceTypeImpl.java:777)
[ERROR]     at jdk.jdi/com.sun.tools.jdi.BaseLineInfo.liSourcePath(BaseLineInfo.java:57)
[ERROR]     at jdk.jdi/com.sun.tools.jdi.LocationImpl.sourcePath(LocationImpl.java:201)
[ERROR]     at jdk.jdi/com.sun.tools.jdi.LocationImpl.sourcePath(LocationImpl.java:196)
[ERROR]     at jdk.jdi/com.sun.tools.jdi.LocationImpl.sourcePath(LocationImpl.java:191)
[ERROR]     at org.javacs.ktda.jdi.JDIDebuggee.sourceOf(JDIDebuggee.kt:171)
[ERROR]     at org.javacs.ktda.jdi.JDIDebuggee.positionOf(JDIDebuggee.kt:167)
[ERROR]     at org.javacs.ktda.jdi.stack.JDIStackFrame.<init>(JDIStackFrame.kt:19)
[ERROR]     at org.javacs.ktda.jdi.stack.JDIStackTrace.<init>(JDIStackTrace.kt:11)
[ERROR]     at org.javacs.ktda.jdi.JDIThread.stackTrace(JDIThread.kt:35)
[ERROR]     at org.javacs.ktda.jdi.JDIThread.stackTrace(JDIThread.kt:14)
[ERROR]     at org.javacs.ktda.adapter.KotlinDebugAdapter.stackTrace(KotlinDebugAdapter.kt:348)
[ERROR]     ... 15 more