Closed d95776 closed 1 month ago
it's better to provide a minimal sample project to reproduce the issue. If your project is private and unable to share it directly, you can create a simple version to demo the issue.
tried different ways to recreate the issue in a smaller scale project but no luck.
Found interesting differences between successful debug java run and failure debug java run. Vscode runs different java commands between them.
For the successful debug java run, vscode runs the following command line: /Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:51511 @/var/folders/1w/spg6p9ns2l71rt48yvkv107c7l6swt/T/cp_6b6vwwbwp921dmyb4k1o39m2v.argfile com.debug.DebugJavaApplication --spring.profiles.active=dev
For the failure debug java run, vscode runs the following command line: /Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:51595 -Dkarate.debug.port=0 -XX:+ShowCodeDetailsInExceptionMessages -cp /Users/hchen/.vscode/extensions/karatelabs.karate-2.0.3/jar/karate-ide.jar com.discover.corebanking.bankdsldeferorforb.BankDSLDeferOrForbApplication --spring.profiles.active=dev
Theoretically, vscode should run the same command line except for application name. For the failure case, the question is what are the following for and why vscode point to a karate-ide.jar in classpath which is not completely related to the application: -Dkarate.debug.port=0 -XX:+ShowCodeDetailsInExceptionMessages -cp /Users/hchen/.vscode/extensions/karatelabs.karate-2.0.3/jar/karate-ide.jar
Could be related. https://github.com/karatelabs/vscode-extension/issues/21
reviewed https://github.com/karatelabs/vscode-extension/issues/21 and looks like it is different issue. if I deleted the karate vscode extension, debug java runs fine. The issue is how to make vscode not use karate-ide.jar when running in debug java mode.
@d95776 From the problem description, looks like it's an issue related with the karatelabs.karate extension. We have nothing to do with it.
Close because of out-of-scope. But open to continue the discussion.
Extension Name: vscode-gradle Extension Version: 3.13.2024011802 OS Version: Ventura 13.6.6 - Darwin arm64 22.6.0 VSCode version: 1.87.2
Describe the bug A clear and concise description of what the bug is. when I run "Debug Java", I got the following error /usr/bin/env /Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:52103 -Dkarate.debug.port=0 -XX:+ShowCodeDetailsInExceptionMessages -cp /Users/hchen/.vscode/extensions/karatelabs.karate-2.0.3/jar/karate-ide.jar com.discover.corebanking.bankdsldeferorforb.BankDSLDeferOrForbApplication Error: Could not find or load main class com.discover.corebanking.bankdsldeferorforb.BankDSLDeferOrForbApplication Caused by: java.lang.ClassNotFoundException: com.discover.corebanking.bankdsldeferorforb.BankDSLDeferOrForbApplication
The class BankDSLDeferOrForbApplication is a spring main class with main() method.
We report the issue in https://github.com/microsoft/vscode-java-debug/issues/1457. However, they recommend to follow the article https://devblogs.microsoft.com/java/new-build-server-for-gradle/. I followed the steps in the article and got the same error.
To Reproduce Steps to reproduce the behavior.
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Output from "Gradle for Java" You can find this by clicking on the "Output" panel, then selecting the "Gradle for Java" channel from the dropdown.
Does the bug still exist if you disable all other extensions? Yes/No
Additional context Add any other context about the problem here.