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
Java extension version: Extension Pack for Java v0.25.7
Java Debugger extension version: Debugger for Java v0.48.0
Steps To Reproduce
I am using vscode to debug a relatively huge java application with multiple maven modules. The core application is loaded and compiled, can be launched successfully in debug mode, and all breakpoints for the code in the main thread are working properly. I managed to debug using launch and attach features.
This Java application has a feature it allows loading the Jython script which will call Java code and classes referenced in JAR files that are specified in the classpath of the java.exe command line. When the main application is launched, you can then load the Jython script. The moment you load a Jython script, it will launch that script in another thread and starts executing.
I managed to launch the application in debug mode using this command line:
The good thing is that if I set a breakpoint on the core application in the main thread, the execution will stop, and I can see the source code and debug without any problem.
In another separate small maven project (which is supposed to be part of the core application), I developed customization for some of the classes in the main application. The custom code is compiled and generated custom JAR files which are added to the classpath of the command line java.exe used to launch the main application. I simply copy the JAR files with the customization to the lib folder of the main application and launch the application using the correct command line which is similar to the one I mentioned above.
The main application and the customizations made are working fine.
My issue is that the breakpoints set for the Java code called from Jython are not working in vscode. In other words, the Jython code is invoking java code which is part of the customized code, and breakpoints set in that code are not working.
Following are the steps I followed to debug and set breakpoints:
Open the main Maven project in vscode.
Open the other Maven project (2nd project) with the customizations using the vscode file/add a folder to the workspace.
Wait until extensions are activated, builds are completed, and both projects are recognized.
Now, I can see the projects under the "JAVA PROJECTS" section as well as under the "MAVEN" section on the left side. No errors and all seem fine.
Save the workspace to a .code-workspace file.
Launch the application with the customization using the command line similar to the one mentioned above - java.exe ..... The launching will happen from another folder on the same laptop using a clean install of the main application with the customized JAR files. It will not launch the application using the Maven Projects of VScode.
From vscode debug view, run the attach debug configuration. It is successful.
Now, the main application is loaded successfully, and all breakpoints in the main thread are hit successfully in vscode.
Set a breakpoint in the Java code which is related to the customized parts in the 2nd Maven Project. Note that the main Maven Project and the Customization Maven Project are two separate projects in the vscode workspace, and they are not connected or related together. I am thinking that this is fine but not sure.
From the main application, load the Jython script that will invoke Java code/classes in the customized JAR files.
Now, here is the problem. I see that the debugger in VSCode is triggered, but I don't see the source code popping up as usual. I see that the debug controls are active, and when I try to click "Next Step" for example, I see the error: Failed to step because the thread 'thread-name' is not suspended in the target VM.
I repeated the steps above several times, but sometimes I don't see the error above when I step through the code. The execution will break and pause, and I can see the debug statements output is correct (in the application output), but, I don't see the source code of the related breakpoint, and I cannot watch any variable.
I noticed that I can step through the code using the controls on the thread item in the "CALL STACK" section on the left panel. Once I click step over, I see the debugging is moving, but no source code is shown. Also, I can see the debug statements output on the console which is related to the breakpoint set.
I appreciate your help to solve this problem.
See the snapshot below for more details.
Current Result
Source code not shown while stepping through in the debug session
Expected Result
Source code lines must be related to the current line being executed while stepping through in the debug session
Additional Information
I could not solve the problem in vscode, but, in less than 5 minutes, I achieved what I wanted to do in Eclipse.
The problem in vscode is that the debugger is breaking somewhere between Jython and Java. I see this error on the "CALL STACK" section on the left panel, under the thread item which is paused due to the breakpoint:
Illegal character <<> at index 71: C:/path/to/project/main/java/source/folder\org\python\pycode\<string>
See the snapshots below for details.
I thought if I kept only one project open in vscode and connect to the remote application running in debug mode, I thought it would work. No matter what I do, it won't show the source code while stepping through the debugging session. In vscode, if I set a breakpoint in the source code, it will break correctly, and I can step through, but the source code is not shown. I cannot even see the binary JAR anywhere on the screen which would allow me to attach the source in vscode. Usually, I see a decompiled version of the class, and I can right-click and attach the source from a ZIP or JAR file, but, in this case, I could not find this option while in the debug session.
Then, I switched to Eclipse and disconnected the debugging session from vscode. In Eclipse, I opened the same project and set up Remote Debugging, and it worked right away without any effort. I think vscode is a waste of time if you want to go to the next level with Java Projects.
The text was updated successfully, but these errors were encountered:
i've reporting the exact same issue with a jhipster project, if i launch from "request": "launch" in my launch.json the debugger report this issue, if i launch from terminal the application and then i attach the debugger with "request": "attach" the debugger work perfectly.
[provide a description of the issue]
Environment
Steps To Reproduce
I am using vscode to debug a relatively huge java application with multiple maven modules. The core application is loaded and compiled, can be launched successfully in debug mode, and all breakpoints for the code in the main thread are working properly. I managed to debug using launch and attach features.
This Java application has a feature it allows loading the
Jython
script which will call Java code and classes referenced in JAR files that are specified in the classpath of thejava.exe
command line. When the main application is launched, you can then load the Jython script. The moment you load a Jython script, it will launch that script in another thread and starts executing.I managed to launch the application in debug mode using this command line:
The above command line is a summarized version of the one I am using to clarify the problem.
From VS Code, I managed to attach it to the running application using this setting in vscode
launch.json
:The good thing is that if I set a breakpoint on the core application in the main thread, the execution will stop, and I can see the source code and debug without any problem.
In another separate small maven project (which is supposed to be part of the core application), I developed customization for some of the classes in the main application. The custom code is compiled and generated custom JAR files which are added to the classpath of the command line
java.exe
used to launch the main application. I simply copy the JAR files with the customization to the lib folder of the main application and launch the application using the correct command line which is similar to the one I mentioned above.The main application and the customizations made are working fine.
My issue is that the breakpoints set for the Java code called from Jython are not working in vscode. In other words, the Jython code is invoking java code which is part of the customized code, and breakpoints set in that code are not working.
Following are the steps I followed to debug and set breakpoints:
Open the main Maven project in vscode.
Open the other Maven project (2nd project) with the customizations using the vscode file/add a folder to the workspace.
Wait until extensions are activated, builds are completed, and both projects are recognized.
Now, I can see the projects under the "JAVA PROJECTS" section as well as under the "MAVEN" section on the left side. No errors and all seem fine.
Save the workspace to a
.code-workspace
file.Launch the application with the customization using the command line similar to the one mentioned above -
java.exe ....
. The launching will happen from another folder on the same laptop using a clean install of the main application with the customized JAR files. It will not launch the application using the Maven Projects of VScode.From vscode debug view, run the attach debug configuration. It is successful.
Now, the main application is loaded successfully, and all breakpoints in the main thread are hit successfully in vscode.
Set a breakpoint in the Java code which is related to the customized parts in the 2nd Maven Project. Note that the main Maven Project and the Customization Maven Project are two separate projects in the vscode workspace, and they are not connected or related together. I am thinking that this is fine but not sure.
From the main application, load the Jython script that will invoke Java code/classes in the customized JAR files.
Now, here is the problem. I see that the debugger in VSCode is triggered, but I don't see the source code popping up as usual. I see that the debug controls are active, and when I try to click "Next Step" for example, I see the error:
Failed to step because the thread 'thread-name' is not suspended in the target VM.
I repeated the steps above several times, but sometimes I don't see the error above when I step through the code. The execution will break and pause, and I can see the debug statements output is correct (in the application output), but, I don't see the source code of the related breakpoint, and I cannot watch any variable.
I noticed that I can step through the code using the controls on the thread item in the "CALL STACK" section on the left panel. Once I click step over, I see the debugging is moving, but no source code is shown. Also, I can see the debug statements output on the console which is related to the breakpoint set.
I appreciate your help to solve this problem.
See the snapshot below for more details.
Current Result
Source code not shown while stepping through in the debug session
Expected Result
Source code lines must be related to the current line being executed while stepping through in the debug session
Additional Information
I could not solve the problem in vscode, but, in less than 5 minutes, I achieved what I wanted to do in Eclipse.
The problem in vscode is that the debugger is breaking somewhere between Jython and Java. I see this error on the "CALL STACK" section on the left panel, under the thread item which is paused due to the breakpoint:
See the snapshots below for details.
I thought if I kept only one project open in vscode and connect to the remote application running in debug mode, I thought it would work. No matter what I do, it won't show the source code while stepping through the debugging session. In vscode, if I set a breakpoint in the source code, it will break correctly, and I can step through, but the source code is not shown. I cannot even see the binary JAR anywhere on the screen which would allow me to attach the source in vscode. Usually, I see a decompiled version of the class, and I can right-click and attach the source from a ZIP or JAR file, but, in this case, I could not find this option while in the debug session.
Then, I switched to Eclipse and disconnected the debugging session from vscode. In Eclipse, I opened the same project and set up Remote Debugging, and it worked right away without any effort. I think vscode is a waste of time if you want to go to the next level with Java Projects.
The text was updated successfully, but these errors were encountered: