Search code examples
javatomcatremote-debugging

how to start tomcat debug port in windows while debugging tomcat application


I'm getting Exception while debugging

Failed to connect to remote VM. Connection refused.
Connection refused: connect.

i have tried command in windows system

netstat -n -a -p tcp

but my port 8787 was not there how to start that port.


Solution

  • Basic config is: In catalina.bat under tomcat/bin file modify the below.

    1. CATALINA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"
    2. JPDA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"
    3. Run Tomcat from command prompt: catalina.sh jpda start

    Then in eclipse create a debug configuration:

    • Write any name for the configuration.
    • Write the project name.
    • Write the connection type as Standard(Socket Attach)
    • Host should be localhost
    • Port as 8000( or any port number, but that should be the same in other places also).

    see: Remote debugging Tomcat with Eclipse