0

I am trying to set-up remote debugging tomcat with Eclipse. As mentioned in this answer. I have added the below lines in my startup.sh at the very start (so that Tomcat always starts in debug mode).

########## Starting Tomcat in Debug mode always #############
JPDA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"
catalina.sh jpda start
#############################################################

In Eclipse I have made the below debug configuration:-

enter image description here

But on launching Eclipse in debug configuration I am getting the below error:-

Failed to connect to Remote VM. Connection Refused.

Environment

  • Tomcat - 7.0.75
  • Eclipse - Version: Mars.2 Release (4.5.2)
  • OS - El Capitan Version 10.11.6 (15G1212)
  • Java - 1.8.0_77

I have also checked that port 8000 is free by executing the below command:-

tuk-MacBook-Pro-4:bin tuk$ lsof -n -i -a | grep "8000"
tuk-MacBook-Pro-4:bin tuk$ 

Tried with a different port, 12345 but getting same error.

Can someone let me know what I am doing wrong and how can I do a remote debugging using eclipse with Tomcat 7?

Community
  • 1
  • 1
tuk
  • 5,941
  • 14
  • 79
  • 162
  • Both the Tomcat config as well as the Eclipse config look good to me. Is the port 8000 available? It might be occupied by another process, or might be blocked by a firewall. Maybe try a different port. – Markus Fischer Feb 17 '17 at 09:26
  • I have updated the question. Port 8000 is not occupied by any other process. Tried with a different port ,`12345` but same error :(. – tuk Feb 17 '17 at 09:39
  • try to "telnet" localhost:8000 - whether it responds – Oo.oO Feb 17 '17 at 17:40

1 Answers1

1

In my case just doing catalina.sh jpda start (I did not have to set JPDA_OPTS.) and checking Allow termination of Remote VM under Debug Configuations -> Remote Java Application in eclipse solved the issue.

tuk
  • 5,941
  • 14
  • 79
  • 162