Santhosh Tpixler
Santhosh Tpixler

Reputation: 371

Remote debugging(NOT localhost) tomcat using eclipse. Connection refused from remote machine

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

Upvotes: 3

Views: 3519

Answers (1)

Santhosh Tpixler
Santhosh Tpixler

Reputation: 371

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

Upvotes: 12

Related Questions