0

I've got a Fedora 38 running:

  • ServiceA hosted in a dockerized JBoss EAP 7.3, listening on 0.0.0.0:8080
  • ServiceB on a plain JBoss EAP 7.3, listening on 0.0.0.0:8085

The two services have to communicate with each other, but while ServiceB can successfully call ServiceA, when ServiceA calls ServiceB it always receives a java.net.ConnectException: Connection refused (Connection refused).

I can successfully call ServiceB through Postman.

I've enabled the broader possible public interface in the standalone.xml of ServiceB, this is the relevant:

    <interfaces>
        <interface name="management">
            <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
        </interface>
        <interface name="public">
                <inet-address value="${jboss.bind.address:0.0.0.0}"/>
        </interface>
    </interfaces>
    <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
        <socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>
        <socket-binding name="http" port="${jboss.http.port:8085}"/>
        <socket-binding name="https" port="${jboss.https.port:8443}"/>
        <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9992}"/>
        <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>
        <socket-binding name="txn-recovery-environment" port="4712"/>
        <socket-binding name="txn-status-manager" port="4713"/>
        <outbound-socket-binding name="mail-smtp">
            <remote-destination host="localhost" port="25"/>
        </outbound-socket-binding>
    </socket-binding-group>

Still ServiceA is failing to call ServiceB.

As a test also stopped firewalld, but to no avail.

I'm clearly missing something, but I have run out of ideas. Suggestions?

voccoeisuoi
  • 325
  • 4
  • 11
  • 1
    Is ServiceA using 127.0.0.1 or 'localhost' for ServiceB? In docker's default network mode (bridge) programs in the host can access ports exposed by or mapped to container(s) using that address but programs in a container can access _only_ ports in the same container not the host. See https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach https://stackoverflow.com/questions/31324981/ https://stackoverflow.com/questions/70006997/ https://stackoverflow.com/questions/46973456/ and many more. – dave_thompson_085 Jul 06 '23 at 19:31
  • Yes, that was it: I've configured the host.docker.internal and now it works, thanks. Please turn your comment into an answer and I'll be happy to accept it. – voccoeisuoi Jul 07 '23 at 01:20

0 Answers0