kotlin-debug-adapter icon indicating copy to clipboard operation
kotlin-debug-adapter copied to clipboard

Cannot Debug Quarkus Kotlin project

Open tuan1nguyen opened this issue 3 years ago • 2 comments

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)

tuan1nguyen avatar Nov 10 '22 20:11 tuan1nguyen

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

  • Create a new Quarkus gradle project (using Kotlin)
  • Set a few breakpoints
  • Build the project with gradle build. The language server is known for reading class files from the target-directory, so if the right files are not present it might complain.
  • Create a launch.json
  • Expand the hello-function to have more lines, and set a few breakpoints.
  • Run debugger. Had to run "quarkus dev" as I could find no tasks named quarkusDev. Not familiar enough with VSCode to try any more than that 😛
  • Everything works! Stops at breakpoints, lets me see variables etc.

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?)

themkat avatar Nov 22 '22 18:11 themkat

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

pF-luis avatar Jan 16 '23 10:01 pF-luis