TechMaster
TechMaster

Reputation: 261

Unable to call a Spring boot Rest Endpoint from arangodb Foxx service in a docker network

I have two services deployed as a docker container on Linux.

CONTAINER ID   IMAGE                COMMAND                  CREATED         STATUS        PORTS                                       NAMES
463bd83993fc   rtm-service:latest   "java -jar rtmapp.jar"   15 hours ago    Up 15 hours   0.0.0.0:8085->9096/tcp, :::8085->9096/tcp   rtm-service-container
54ff37336885   arangodb:3.5.7       "/entrypoint.sh aran…"   18 months ago   Up 15 hours   0.0.0.0:8529->8529/tcp, :::8529->8529/tcp   arangodb_1

To make two services talk to each other i have created shared docker network and added both services in it

sdk@W10NCT40:~$ docker network inspect rtm-network
[
    {
        "Name": "rtm-network",
        "Id": "9fd06cb71df3a171fce1120e030a63159812cbdc0a83d4d54235dfe13a2e2eac",
        "Created": "2023-03-29T10:32:02.1767092Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "172.19.0.0/16",
                    "Gateway": "172.19.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "463bd83993fc74c52db29d570d8d70e4915d0651e6f6017a4fd0be22a48f00e2": {
                "Name": "rtm-service-container",
                "EndpointID": "7bbac30d3ae264137988913721b308ed7c41557411abc46bc69df6dcec132181",
                "MacAddress": "02:42:ac:13:00:03",
                "IPv4Address": "172.19.0.3/16",
                "IPv6Address": ""
            },
            "54ff37336885dc2d2fa9f838fd22f7994a274f0f7aeeb2598ff48ed7e97af323": {
                "Name": "arangodb_1",
                "EndpointID": "bd65ceb810c40b71feaa9c4658142e1561797fb74e5a888d3a091bfc069790f9",
                "MacAddress": "02:42:ac:13:00:02",
                "IPv4Address": "172.19.0.2/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]

docker network is correct because i am able to call arangodb Foxx service from spring boot app but not the other way around

As per provided documentation I am using "@arangodb/request" module. So i tried calling spring boot app rest end point from my arangdb foxx service via following code

const request = require("@arangodb/request");
const response = request.get(
        "http://rtm-service-container:8085/rtm/request-management/products-list"
      );
console.log(response)

The following code runs fine but instead of receivng a product-list in i get following error message on arangodb side

[IncomingResponse 500 Could not connect to 'http+tcp://rtm-service-container:8085' 'connect() failed with #111 - Connection refused' empty]

On my spring boot app, I receive no get request.

I am expecting a proper rest call from arangodb foxx service to my spring boot app and should be able to receive products-list as a response.

I am not sure what is wrong here and what should i do to successfully call spring boot rest end point from my arandb foxx service ?,

Upvotes: 0

Views: 80

Answers (0)

Related Questions