microsoft / vscode-java-debug

Java Debugger for Visual Studio Code.
Other
524 stars 334 forks source link

Failed to attach to remote debuggee VM. Reason: com.sun.jdi.connect.spi.ClosedConnectionException #221

Closed JunQianZ closed 6 years ago

JunQianZ commented 6 years ago

try to attach an Java web project to running tomcat on localhost, and do debugging, it failed, with below errors: Failed to attach to remote debuggee VM. Reason: com.sun.jdi.connect.spi.ClosedConnectionException

Environment
Steps To Reproduce
  1. [step 1] add tomcat add-in to tfs, and config tomcat to run successfully. run on http://localhost:9090/
  2. [step 2] try to attach a java web project to running tomcat and do debugging on visual studio code

[attach a sample project reproducing the error] for the launch.json: "version": "0.2.0", "configurations": [ { "type": "java", "name": "Debug (Attach to Tomcat server)", "request": "attach", "hostName": "127.0.0.1", "port": 9090 }, attach logs

Current Result

image

Expected Result
Additional Informations
testforstephen commented 6 years ago

@JunQianZ Port 9090 is the application port (for http), not the debug port. One of our team members published a dedicated tomcat extension https://marketplace.visualstudio.com/items?itemName=adashen.vscode-tomcat, i would suggest you to use it for tomcat debugging.

JunQianZ commented 6 years ago

@testforstephen so what should be the debug port? and I did use the tomcat debugging. the tomcat is configured launched successfully from my visual studio code.

testforstephen commented 6 years ago

Please refer to this doc for enabling remote debugging on tomcat. https://stackoverflow.com/questions/3835612/remote-debugging-tomcat-with-eclipse

akaroml commented 6 years ago

@JunQianZ thanks for reporting. This issue can be addressed by following the stackoverflow discussion. Close for now.

Aman-kumar-1999 commented 2 months ago

I have changed the testing port then It works