javadebuggingvisual-studio-codedocker-containerstormcrawler

How can i debug the the docker container(storm crawler) which is written in java in vs code?


I am unable to get how can i debug the docker container(which is running storm crawler) in the vs code? I tried looking for https://code.visualstudio.com/docs/containers/debug-common and other https://github.com/DigitalPebble/storm-crawler/wiki/Debug-with-Eclipse. But I did not anything, like how can i configure launch.json file for the same.

Can anyone guide me how can i do this?


Solution

  • This solves problem for me: Writing launch.json file as :

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

    and connecting it to docker container of storm crawler as:

    version: "3"
    
    services:
      storm-jar:
        command: bash -c "storm kill crawler -w 0 ; storm local target/stormcrawler-1.0.jar org.apache.storm.flux.Flux es-crawler.flux --sleep 86400000" 
        environment:
          - STORM_JAR_JVM_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000"
        ports:
          - 8000:8000
    
    

    where enviroment to debug storm crawler has been provided on wiki page of github of storm crawler: https://github.com/DigitalPebble/storm-crawler/wiki/Debug-with-Eclipse