You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attaching to a Java process built with a custom bazel-based build system, the Java debugger can't resolved source even though the file is open, reporting "Unknown source".
Environment
Operating System: Windows 11 Enterprise locally, Linux remotely.
JDK version: Adoptium Temurin-17 (tried 21 as well)
Start Visual Studio Code and connect to the SSH host.
In Terminal, build (using proprietary bazel-based build system).
In Terminal, change to the directory where the result JARs are produced.
Open the source file with the main function (Pos001.java, in this case).
Create a java attach-to-process debugger config. No special settings, just type, name, request, processId set as: "type": "java", "name": "Java attach to process", "projectName": "acquiretokenbyuserid", "request": "attach", "processId":"${command:PickJavaProcess}",
Run main in the target class using typical attach to process parameters as shown below. It is waiting for a keystroke. java -agentlib:jdwp=transport=dt_socket,server=y,address=5005 -verbose -cp "./*" packagename1.packagename2.Pos001
In Visual Studio, attach to the process and set a breakpoint just after where the code is waiting for the keystroke.
In the Terminal window where the process was run, press enter.
Call stack reports Unknown source and the current source line is not highlighted. The call stack does correctly report the filename and line number of where the program is, so you can manually scroll through. Stepping through and further breakpoints work normally, just with this limitation.
Expected Result
Debugger should highlight the current line and recognize the open file in the editor as the correct source. Or at least, it should behave as Real Visual Studio, asking me "should I use this file?" or allowing me to browse for it.
Additional Informations
Language Support for Java window reports several instances of the following: [Error - 6:19:42 PM] Apr 21, 2024, 6:19:42 PM _/lotus-qe/core-pfs/src/test/java/sts/acquiretokenbyuserid [in rpsmain2_f021ed] does not exist _/lotus-qe/core-pfs/src/test/java/sts/acquiretokenbyuserid [in rpsmain2_f021ed] does not exist Java Model Exception: Error in Java Model (code 969): _/lotus-qe/core-pfs/src/test/java/sts/acquiretokenbyuserid [in rpsmain2_f021ed] does not exist at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:562) at org.eclipse.jdt.internal.core.PackageFragmentRoot.getUnderlyingResource(PackageFragmentRoot.java:764) at org.eclipse.jdt.internal.core.PackageFragment.getUnderlyingResource(PackageFragment.java:430) at org.eclipse.jdt.internal.core.Openable.getUnderlyingResource(Openable.java:328) at org.eclipse.jdt.internal.core.CompilationUnit.getUnderlyingResource(CompilationUnit.java:975) at org.eclipse.jdt.ls.core.internal.handlers.BaseDiagnosticsHandler.collectNonJavaProblems(BaseDiagnosticsHandler.java:149) at org.eclipse.jdt.ls.core.internal.handlers.BaseDiagnosticsHandler.endReporting(BaseDiagnosticsHandler.java:135) at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.reportProblems(ReconcileWorkingCopyOperation.java:141) at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:110) at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:740) at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:805) at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1311) at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler.publishDiagnostics(BaseDocumentLifeCycleHandler.java:332) at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler.publishDiagnostics(BaseDocumentLifeCycleHandler.java:295) at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler$PublishDiagnosticJob.run(BaseDocumentLifeCycleHandler.java:777) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
There's no maven or gradle files in this project, it uses a custom bazel-based build.
Disabled Maven and Gradle project import, but this seems to make no difference. Debugger appears built to require these.
Set sourcePaths in debugger config, no help.
If it matters, JDK is configured via java.jdt.ls.java.home in settings.json on remote host.
The text was updated successfully, but these errors were encountered:
The debugger leverages the RedHat Java language server to recoginize the Java project and get the source mapping, which doesn't provide the native support for bazel build tool. You may have a try on this bazel language support extension. https://marketplace.visualstudio.com/items?itemName=sfdc.bazel-vscode-java
When attaching to a Java process built with a custom bazel-based build system, the Java debugger can't resolved source even though the file is open, reporting "Unknown source".
Environment
Steps To Reproduce
"type": "java", "name": "Java attach to process", "projectName": "acquiretokenbyuserid", "request": "attach", "processId":"${command:PickJavaProcess}",
java -agentlib:jdwp=transport=dt_socket,server=y,address=5005 -verbose -cp "./*" packagename1.packagename2.Pos001
Logs: LanguageServerLogFile.txt
I can't provide source or project, sorry.
Current Result
Call stack reports Unknown source and the current source line is not highlighted. The call stack does correctly report the filename and line number of where the program is, so you can manually scroll through. Stepping through and further breakpoints work normally, just with this limitation.
Expected Result
Debugger should highlight the current line and recognize the open file in the editor as the correct source. Or at least, it should behave as Real Visual Studio, asking me "should I use this file?" or allowing me to browse for it.
Additional Informations
[Error - 6:19:42 PM] Apr 21, 2024, 6:19:42 PM _/lotus-qe/core-pfs/src/test/java/sts/acquiretokenbyuserid [in rpsmain2_f021ed] does not exist _/lotus-qe/core-pfs/src/test/java/sts/acquiretokenbyuserid [in rpsmain2_f021ed] does not exist Java Model Exception: Error in Java Model (code 969): _/lotus-qe/core-pfs/src/test/java/sts/acquiretokenbyuserid [in rpsmain2_f021ed] does not exist at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:562) at org.eclipse.jdt.internal.core.PackageFragmentRoot.getUnderlyingResource(PackageFragmentRoot.java:764) at org.eclipse.jdt.internal.core.PackageFragment.getUnderlyingResource(PackageFragment.java:430) at org.eclipse.jdt.internal.core.Openable.getUnderlyingResource(Openable.java:328) at org.eclipse.jdt.internal.core.CompilationUnit.getUnderlyingResource(CompilationUnit.java:975) at org.eclipse.jdt.ls.core.internal.handlers.BaseDiagnosticsHandler.collectNonJavaProblems(BaseDiagnosticsHandler.java:149) at org.eclipse.jdt.ls.core.internal.handlers.BaseDiagnosticsHandler.endReporting(BaseDiagnosticsHandler.java:135) at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.reportProblems(ReconcileWorkingCopyOperation.java:141) at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:110) at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:740) at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:805) at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1311) at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler.publishDiagnostics(BaseDocumentLifeCycleHandler.java:332) at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler.publishDiagnostics(BaseDocumentLifeCycleHandler.java:295) at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler$PublishDiagnosticJob.run(BaseDocumentLifeCycleHandler.java:777) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
The text was updated successfully, but these errors were encountered: