Search code examples
javatomcatintellij-idearemote-debugging

TomCat server configuration not appearing in Intelliji


im trying to set up remote debugging in a tom cat server i have already running. The problem i have is that when i try to edit the run configuration tomcat server is not an option in Intelliji. Here are some images to demo clearly my issue:

enter image description here

UPDATE: AFTER Creating a debug configuration now im getting the following error: enter image description here

i also checked the first line of my running servers log statment and it showed its running on 8081:

Listening for transport dt_socket at address: 8081

Here is my intelliji debug configuration:

enter image description here


Solution

  • Add usual remote debug configuration as shown below (you should specify port). And i suppose you run tomcat in jpda mode. enter image description here

    EDIT:

    For enable JPDA debugger run tomcat with command below:

    catalina.sh jpda run or catalina.sh jpda start

    you can check port number in catalina.sh, for example tomcat 7.0.27

    if [ "$1" = "jpda" ] ; then
      if [ -z "$JPDA_TRANSPORT" ]; then
        JPDA_TRANSPORT="dt_socket"
      fi
      if [ -z "$JPDA_ADDRESS" ]; then
        JPDA_ADDRESS="8000"
      fi
      if [ -z "$JPDA_SUSPEND" ]; then
        JPDA_SUSPEND="n"
      fi
      if [ -z "$JPDA_OPTS" ]; then
        JPDA_OPTS="-agentlib:jdwp=transport=$JPDA_TRANSPORT,address=$JPDA_ADDRESS,server=y,suspend=$JPDA_SUSPEND"
      fi
      CATALINA_OPTS="$CATALINA_OPTS $JPDA_OPTS"
      shift
    fi
    

    as you can see in script, it add exactly the same command line arguments as on screenshot.

    If you are using Windows, replace script name with catalina.bat