DonJayamanne / javaVSCode

Extension for java development on VSCode (deprecated)
https://marketplace.visualstudio.com/items?itemName=donjayamanne.javaDebugger
MIT License
43 stars 29 forks source link

Can't get remote debugger to connect #39

Open mvanveen82 opened 7 years ago

mvanveen82 commented 7 years ago

Hi,

I have a springboot java backend to which I'm trying to connect with the debugger. When starting the debugger the debugger controls appear at the top of the screen but only the stop en retry buttons are active. And the nightrider style loader under de debug configuration keeps flashing. So it seems it tries to connect but can't. However I get no error. Also the console of the springboot app show nothing. Only when stopping the debugger it reprints "Listening for transport dt_socket at address: 5005"

setting in pom.xml for debugging

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
        <version>${project.parent.version}</version>
        <dependencies>
             <dependency>
                 <groupId>org.springframework</groupId>
                 <artifactId>springloaded</artifactId>
                  <version>1.2.6.RELEASE</version>
             </dependency>
        </dependencies>
    <configuration>
           <jvmArguments>
         -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
       </jvmArguments>
    </configuration>
</plugin>

task (tasks.json) with which I launch the springboot app:

{
    "version": "0.1.0",
    "command": "mvn",
    "isShellCommand": true,
    "showOutput": "silent",
    "args": [
    ],
    "tasks": [
        {
            "taskName": "Spring Boot Run",
            "suppressTaskName": true,
            "args": [
                "spring-boot:run"
            ],
            "showOutput": "always"
        }
    ]
}

Lauch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Java remote debugging",
            "type": "java",
            "request": "attach",
            "remoteHost": "localhost",
            "remotePort": 5005,
            "cwd": "${workspaceRoot}",
            "jdkPath": "/usr/local/var/jenv/shims",
            "startupClass": "${workspaceRoot}/target/classes/nl/bereslim/BsmBackendApplication",
            "options": [
                "-classpath",
                "${workspaceRoot}"
            ]
        }
    ]
}
faustinoaq commented 7 years ago

I think you need to change your "startupClass" and add "sourcepath". You can try to hack your launch configuration since it extension still lacks of some documentation.

dueckminor commented 7 years ago

Hmm, seems to be same problem as https://github.com/DonJayamanne/javaVSCode/pull/56 I've seen the same effect while trying to attach to a multithreaded local process.