3

I have started tomcat with jpda option in a remote machine(not localhost). I was not able to access the port. It throws a connection refused. I was able to do this in localhost successfully. Then why not from a remote machine. I am using tomcat 9.X and ubuntu 16.04 and java 8

Edit 1: The JDWP port 8000 listens only to 127.0.0.1. Is it possible to change this? enter image description here

Santhosh Tpixler
  • 361
  • 4
  • 12
  • Test the tcp port: Follow these steps to test a TCP connection with telnet Open a command prompt Use the following Syntax: telnet Does it work? – pwain Dec 06 '18 at 12:42
  • telnet: Unable to connect to remote host: Connection refused – Santhosh Tpixler Dec 06 '18 at 12:45
  • I have also allowed port 8000 in UFW. netstat shows port is used by java application. I am able access the application – Santhosh Tpixler Dec 06 '18 at 12:47
  • Could you check this link:https://www.eclipse.org/jetty/documentation/9.4.x/enable-remote-debugging.html. Looks for me useful. – pwain Dec 06 '18 at 13:17

1 Answers1

11

Finally, I found the issue. By default Catalina.sh(Tomcat script) binds only to localhost. If you want to access from another machine, then do

export JPDA_ADDRESS=0.0.0.0:8000
sh catalina.sh jpda start

0.0.0.0 allows from all the interfaces. You can also configure to one IP.

Another working solution is to do ssh tunnel from the remote machine to debugger machine.

ssh -L 8000:localhost:8000 user@remotemachine

If you still face any issues, then check the firewall. In ubuntu you can do it using UFW(Uncomplicated firewall)

sudo ufw enable
sudo ufw allow 8000
Santhosh Tpixler
  • 361
  • 4
  • 12