Unable to Debug/Attch Java Maven on Vscode
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- java, vscode
- Domain
- developer-experience, devtools
Research direction
Start by reproducing the failure with the shown setting.json and Java launch configuration, then inspect the java-debug log around AttachRequestHandler.java and the connection-refused error. Compare launch and attach behavior on the reported Windows and JDK versions; done means the debugger remains connected and can attach to the selected Java process.
Written by the indexing model from the issue text.
Description
Unable to debug Java Maven Project.
Environment
- Operating System: Win10 Enterprise . Build No : 19045.3208 version : 22H2
- JDK version: 1.8.0_281
- Visual Studio Code version: 1.81.1 User Setup
- Java extension version: 0.25.13
- Java Debugger extension version: v0.54.0
Steps To Reproduce
- Vs code setting.json
{
"update.mode": "none",
"workbench.startupEditor": "none",
"telemetry.telemetryLevel": "off",
"java.autobuild.enabled": false,
"java.configuration.runtimes": [
{
"name": "JavaSE-1.8",
"default": true,
"path": "C:\\Program Files\\Java\\jdk1.8.0_281"
}
]
}
- java debug log file
!ENTRY java-debug 1 0 2023-08-29 22:05:54.430
!MESSAGE Trying to attach to remote debuggee VM localhost:61739 .!ENTRY java-debug 4 0 2023-08-29 22:05:54.468
!MESSAGE [error response][attach]: Failed to attach to remote debuggee VM. Reason: java.net.ConnectException: Connection refused: connect
!STACK 0
com.microsoft.java.debug.core.DebugException: Failed to attach to remote debuggee VM. Reason: java.net.ConnectException: Connection refused: connect
at com.microsoft.java.debug.core.adapter.AdapterUtils.createCompletionException(AdapterUtils.java:266)
at com.microsoft.java.debug.core.adapter.handler.AttachRequestHandler.handle(AttachRequestHandler.java:81)
at com.microsoft.java.debug.core.adapter.DebugAdapter.lambda$dispatchRequest$0(DebugAdapter.java:94)
at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.thenCompose(Unknown Source)
at com.microsoft.java.debug.core.adapter.DebugAdapter.dispatchRequest(DebugAdapter.java:93)
at com.microsoft.java.debug.core.adapter.ProtocolServer.dispatchRequest(ProtocolServer.java:118)
at com.microsoft.java.debug.core.protocol.AbstractProtocolServer.lambda$new$0(AbstractProtocolServer.java:81)
at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:63)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal(ObservableObserveOn.java:201)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(ObservableObserveOn.java:255)
at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection refused: connect
at java.base/sun.nio.ch.Net.connect0(Native Method)
at java.base/sun.nio.ch.Net.connect(Unknown Source)
at java.base/sun.nio.ch.Net.connect(Unknown Source)
at java.base/sun.nio.ch.NioSocketImpl.connect(Unknown Source)
at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
at java.base/java.net.Socket.connect(Unknown Source)
at java.base/java.net.Socket.connect(Unknown Source)
at java.base/java.net.Socket.(Unknown Source)
at java.base/java.net.Socket.(Unknown Source)
at org.eclipse.jdi.internal.connect.SocketTransportService$2.run(SocketTransportService.java:147)
... 1 more
Launch setting file
{
"type": "java",
"name": "Attach Service",
"request": "attach",
"processId" : "${command:PickJavaProcess}",
"timeout": 300000
}
Current Result
When the type is launch in Launch setting , the debugger starts but after a certain time period the debugger stops , but application is in running mode in the backend . on Debugger console I can see "ERROR: transport error 202: recv error: Connection reset by peer".
So I tried to do attach java process , Vscode is not able to attach , it shows the java process on popup , when I click on it , it throws error dialog saying "Failed to attach remote debuggee VM. Reason java.net.connectException:connection refused connect"
Expected Result
debugger should work
Additional Informations
Back 5/6months ago , I was able to do the debugging correct with the same project on vscode , then I recently updated it to debug the same project and its throwing exception now.
- Dominant language
- TypeScript
- Stars
- 591
- Forks
- 429
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 19
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/vscode-java-debug
-
ai-triaged enhancement
Difficulty 3/5 1-2 days Newbie friendliness 55/100
microsoft/vscode-java-debug#1689 · 2 comments ·
-
ai-triaged bug
microsoft/vscode-java-debug#1666 · 1 comment · 1 assignee ·
-
ai-triaged bug
Difficulty 3/5 1-2 days Newbie friendliness 48/100
microsoft/vscode-java-debug#1658 · 1 comment ·
-
ai-triaged enhancement
Difficulty 4/5 3-5 days Newbie friendliness 45/100
microsoft/vscode-java-debug#1628 · 3 comments ·
-
Feature support. Openai-triaged enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
microsoft/vscode-java-debug#1616 · 1 comment ·
All issues in microsoft/vscode-java-debug
Similar issues
-
clawsweeper:linked-pr-open clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:message-loss issue-rating: 🦞 diamond lobster maturity:stable P2
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#616 ·
-
ZCode 3.14.3 に対応する Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
supermomonga/zcode-acp#24 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
growthbook/growthbook#7100 ·
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100