3

I'm trying to attach my Eclipse debugger running on my Windows host to a Tomcat 8 server running in my Vagrant box running CentOS 7.

The issue is something to do with the networking setup of Vagrant I believe.

Here is the full error from the Eclipse logs:

java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:179)
    at java.io.DataInputStream.readFully(DataInputStream.java:189)
    at java.io.DataInputStream.readFully(DataInputStream.java:163)
    at org.eclipse.jdi.internal.connect.SocketTransportService.readHandshake(SocketTransportService.java:216)
    at org.eclipse.jdi.internal.connect.SocketTransportService.access$7(SocketTransportService.java:212)
    at org.eclipse.jdi.internal.connect.SocketTransportService$3.run(SocketTransportService.java:183)
    at java.lang.Thread.run(Thread.java:761)

The output from vagrant up seems correct (port 8000 is the debugging port):

==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 8000 => 8000 (adapter 1)
    default: 8443 => 8443 (adapter 1)
    default: 22 => 2222 (adapter 1)

I can access my application (using https://localhost:8443/app) via a browser from my host without issue; connecting the debugger is the issue. The debugger is configured for a Remote Java Application with connection properties:

Host: localhost
Port: 8000

Starting Tomcat of course displays the correct:

Listening for transport dt_socket at address: 8000

Based on the following questions, the answer maybe have something to do with configuring Tomcat to run on 0.0.0.0 instead of the default:

Cannot reach Jekyll server on Vagrant from outside
Vagrant port forwarding not working. Cups not accesible from host
Empty reply from server - can't connect to vagrant vm w/port forwarding
Connection Reset when port forwarding with Vagrant

So I tried configuring the Connectors in Tomcat's server.xml with the line address="0.0.0.0" but the result was the same.

Any other ideas about getting this to work? Also, assuming the answer is something to do with changing the address to 0.0.0.0, why would I need to do that to get the debugger to work if accessing the app via browser is already fine on localhost:8443?

P.S. It is not a firewall issue.

1 Answer 1

2

I was on the right track above changing the address to 0.0.0.0, but I was changing that on the Connector in server.xml, which has nothing to do with the debugger. The resolution is to change the JPDA_ADDRESS resulting in my bin/setenv.sh getting:

JPDA_ADDRESS="0.0.0.0:8000"

This is due to a change in Tomcat 8:

When starting Tomcat with the jpda option to enable remote debugging, Tomcat 8 listens on localhost:8000 by default. Earlier versions listened on *:8000. If required, this default can be overridden by setting the JPDA_ADDRESS environment variable in, for example, setenv.[bat|sh].

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.