Vscode-java-debug: Debug Java Web Applications

Created on 8 Nov 2017  路  5Comments  路  Source: microsoft/vscode-java-debug

Hello!

I suppose my question can be quite stupid because I have not enough experience with Java. But anyway. Is there possible to debug Java Web Applications? For example, I have an application which can be hosted on Apache Tomcat and I would like to debug it in VSCode using your extension, like I can debug it in Eclipse or IntelliJ IDEA using an appropriate debug configuration.

backlog

Most helpful comment

Currently, the launch mode cannot support launch web app in web container, but the attach mode should support debug servlet (jsp is not supported) , but we have not tested it yet, I will keep this issue open as the task from supporting web containers, please keep eyes on this issue for updates.

All 5 comments

Currently, the launch mode cannot support launch web app in web container, but the attach mode should support debug servlet (jsp is not supported) , but we have not tested it yet, I will keep this issue open as the task from supporting web containers, please keep eyes on this issue for updates.

@AlexMAS take a look at this article. Even if you don't use JRebel, you'll see how to attach the debugger to a remote tomcat process.

@fbricon thank you, it works fine!

I have a Gradle project, so I imported the gretty plugin as described comprehensively in this article and configured an appropriate task to run the project:

{
    "taskName": "Run Debug",
    "type": "shell",
    "command": "gradlew appRunDebug",
    "group": "build",
    "problemMatcher": []
}

You also have to configure debug options like next:

allprojects {

    apply plugin: 'org.akhikhl.gretty'

    gretty {

        // Hosting
        servletContainer = 'tomcat8'
        host = 'localhost'
        httpPort = 8080

        // Debug
        debugPort = 5005
        debugSuspend = true
    }
}

And finally the launch configuration:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "Debug (Attach)",
            "request": "attach",
            "hostName": "localhost",
            "port": 5005
        }
    ]
}

Please take a look at this plugin, we will prepare the tutorials for debug java web apps(jsp is not supported by now) .

hi @andxu i too have trouble figuring out how to do it
any news on the tutorial?

cheers

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mentaloaf picture mentaloaf  路  6Comments

manastalukdar picture manastalukdar  路  7Comments

khe817 picture khe817  路  4Comments

llgcode picture llgcode  路  7Comments

isidorn picture isidorn  路  4Comments