Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Docker compose com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server

datdatyul

Active Coder
I tried to implement an **example** of **Spring Boot Microservice** examples.
I have a problem in **docker-compose** file.

**Eureka server** and **api gateways** throws an **issue** defined below while there is no issue in config server.

Here is the issue : `com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server`

Here is the **code snippets** **for config server**.

configserver: image: configserver container_name: configServer build: context: ./configserver dockerfile: Dockerfile environment: CONFIGSERVER_URI: "http://localhost:9191" CONFIGSERVER_PORT: "9191" ports: - "9191:9191" networks: backend: aliases: - "configserver"


Here is the **code snippets** for **eureka server**

eurekaserver: image: eurekaserver ports: - "8761:8761" build: context: ./discoveryserver dockerfile: Dockerfile environment: CONFIGSERVER_URI: "http://localhost:9191" CONFIGSERVER_PORT: "9191" EUREKASERVER_URI: "http://localhost:8761/eureka/" EUREKASERVER_PORT: "8761" depends_on: configserver: condition: service_started networks: backend: aliases: - "eurekaserver"

Here is the **code snippets** for **api gateway server**.

gatewayserver: image: gatewayserver ports: - "8600:8600" build: context: ./api-gateway dockerfile: Dockerfile environment: PROFILE: "default" SERVER_PORT: "8600" CONFIGSERVER_URI: "http://localhost:9191" EUREKASERVER_URI: "http://localhost:8761/eureka/" EUREKASERVER_PORT: "8761" CONFIGSERVER_PORT: "9191" depends_on: configserver: condition: service_started eurekaserver: condition: service_started networks: backend: aliases: - "gateway"



Here is all docker-compose.yml : Link
 
I tried to implement an **example** of **Spring Boot Microservice** examples.
I have a problem in **docker-compose** file.

**Eureka server** and **api gateways** throws an **issue** defined below while there is no issue in config server.

Here is the issue : `com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server`

Here is the **code snippets** **for config server**.

configserver: image: configserver container_name: configServer build: context: ./configserver dockerfile: Dockerfile environment: CONFIGSERVER_URI: "http://localhost:9191" CONFIGSERVER_PORT: "9191" ports: - "9191:9191" networks: backend: aliases: - "configserver"


Here is the **code snippets** for **eureka server**

eurekaserver: image: eurekaserver ports: - "8761:8761" build: context: ./discoveryserver dockerfile: Dockerfile environment: CONFIGSERVER_URI: "http://localhost:9191" CONFIGSERVER_PORT: "9191" EUREKASERVER_URI: "http://localhost:8761/eureka/" EUREKASERVER_PORT: "8761" depends_on: configserver: condition: service_started networks: backend: aliases: - "eurekaserver"

Here is the **code snippets** for **api gateway server**.

gatewayserver: image: gatewayserver ports: - "8600:8600" build: context: ./api-gateway dockerfile: Dockerfile environment: PROFILE: "default" SERVER_PORT: "8600" CONFIGSERVER_URI: "http://localhost:9191" EUREKASERVER_URI: "http://localhost:8761/eureka/" EUREKASERVER_PORT: "8761" CONFIGSERVER_PORT: "9191" depends_on: configserver: condition: service_started eurekaserver: condition: service_started networks: backend: aliases: - "gateway"



Here is all docker-compose.yml : Link
Hi there, I have a suspicion that you may have a misconfigured connection, but can't tell due to the lack of error messages. Could you please post the exact error messages you are seeing in your console? I did a quick search for the error
`com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server` and several things popped up.
 
Hi there, I have a suspicion that you may have a misconfigured connection, but can't tell due to the lack of error messages. Could you please post the exact error messages you are seeing in your console? I did a quick search for the error
`com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server` and several things popped up.
Here are some screenshots to show logs : Link
I haven't fixed them for nearly one week. I hope you can help me.
 
Here are some screenshots to show logs : Link
I haven't fixed them for nearly one week. I hope you can help me.
I removed **localhost** in this line and revised it shown below ```spring.config.import=optional:configserver:http://configserver:9191/```

I removed **localhost** in application.properties file under config server and revised mysql connection shown below.

```
spring.datasource.url=jdbc:mysql://database:3306/springbootadvertisement?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Turkey

eureka.client.serviceUrl.defaultZone=http://eurekaserver:8761/eureka

```. I changed it but I still got the same issue.
 
All these are not suitable for here as there are a lot of logs for each service. Is it possible to look through screenshots if you don't mind
If you could please copy and paste the error messages, so that if anyone else having this kind of issue can see this and be able to solve it as well.
 
If you could please copy and paste the error messages, so that if anyone else having this kind of issue can see this and be able to solve it as well.
@datdatyul IF you do not feel comfortable posting them yourself, feel free to send me a private message with the error logs. Please copy and paste the error messages, no screenshots, or no google drive links please.
 
@datdatyul IF you do not feel comfortable posting them yourself, feel free to send me a private message with the error logs. Please copy and paste the error messages, no screenshots, or no google drive links please.
I tried to share logs with you. All these are listed.

Here are **errors** coming from **eureka server** and **api gateway**


Code:
Fetching config from server at : http://localhost:9191/
    Connect Timeout Exception on Url - http://localhost:9191/. Will be trying the next url
    if available
     Could not locate PropertySource ([ConfigServerConfigDataResource@4a003cbe uris = array<
    String>['http://localhost:9191/'], optional = true, profiles = list['default']]): I/O error on GET request for "http://localhost:9191/discovery-server/default": Connection refused (Con
    nection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused)
    Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8761/eu
    reka/}, exception=java.net.ConnectException: Connection refused (Connection refused) stacktrace=com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection
    refused (Connection refused)
    Caused by: java.net.ConnectException: Connection refused (Connection refused)

Here are **errors** coming from **management service**


Code:
Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8761/eu
    reka/}, exception=I/O error on PUT request for "http://localhost:8761/eureka/apps/MANAGEMENT-SERVICE/37041344b48b:management-service:9002": Connect to localhost:8761 [localhost/127.0.0
    .1] failed: Connection refused (Connection refused); nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:8761 [localhost/127.0.0.1] failed: Connecti
    on refused (Connection refused) stacktrace=org.springframework.web.client.ResourceAccessException: I/O error on PUT request for "http://localhost:8761/eureka/apps/MANAGEMENT-SERVICE/37
    041344b48b:management-service:9002": Connect to localhost:8761 [localhost/127.0.0.1] failed: Connection refused (Connection refused); nested exception is org.apache.http.conn.HttpHostC
    onnectException: Connect to localhost:8761 [localhost/127.0.0.1] failed: Connection refused (Connection refused)

Here are errors from **user service**, **advertisement service** and **report service**.


Code:
Fetching config from server at : http://localhost:9191/
    Connect Timeout Exception on Url - http://localhost:9191/. Will be trying the next url
    if available
    Could not locate PropertySource ([ConfigServerConfigDataResource@5e2c3d18 uris = array<
    String>['http://localhost:9191/'], optional = true, profiles = list['default']]): I/O error on GET request for "http://localhost:9191/user-service/default": Connection refused (Connect
    ion refused); nested exception is java.net.ConnectException: Connection refused (Connection refused)
    Failed to create instance of driver class org.hibernate.dialect.MySQL8Dialect, trying j
    dbcUrl resolution
    java.lang.ClassCastException: class org.hibernate.dialect.MySQL8Dialect cannot be cast to class java.sql.Driver (org.hibernate.dialect.MySQL8Dialect is in unnamed module of loader org.
    springframework.boot.loader.LaunchedURLClassLoader @2096442d; java.sql.Driver is in module java.sql of loader 'platform')
    Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
 
I tried to share logs with you. All these are listed.

Here are **errors** coming from **eureka server** and **api gateway**


Code:
Fetching config from server at : http://localhost:9191/
    Connect Timeout Exception on Url - http://localhost:9191/. Will be trying the next url
    if available
     Could not locate PropertySource ([ConfigServerConfigDataResource@4a003cbe uris = array<
    String>['http://localhost:9191/'], optional = true, profiles = list['default']]): I/O error on GET request for "http://localhost:9191/discovery-server/default": Connection refused (Con
    nection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused)
    Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8761/eu
    reka/}, exception=java.net.ConnectException: Connection refused (Connection refused) stacktrace=com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection
    refused (Connection refused)
    Caused by: java.net.ConnectException: Connection refused (Connection refused)

Here are **errors** coming from **management service**


Code:
Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8761/eu
    reka/}, exception=I/O error on PUT request for "http://localhost:8761/eureka/apps/MANAGEMENT-SERVICE/37041344b48b:management-service:9002": Connect to localhost:8761 [localhost/127.0.0
    .1] failed: Connection refused (Connection refused); nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:8761 [localhost/127.0.0.1] failed: Connecti
    on refused (Connection refused) stacktrace=org.springframework.web.client.ResourceAccessException: I/O error on PUT request for "http://localhost:8761/eureka/apps/MANAGEMENT-SERVICE/37
    041344b48b:management-service:9002": Connect to localhost:8761 [localhost/127.0.0.1] failed: Connection refused (Connection refused); nested exception is org.apache.http.conn.HttpHostC
    onnectException: Connect to localhost:8761 [localhost/127.0.0.1] failed: Connection refused (Connection refused)

Here are errors from **user service**, **advertisement service** and **report service**.


Code:
Fetching config from server at : http://localhost:9191/
    Connect Timeout Exception on Url - http://localhost:9191/. Will be trying the next url
    if available
    Could not locate PropertySource ([ConfigServerConfigDataResource@5e2c3d18 uris = array<
    String>['http://localhost:9191/'], optional = true, profiles = list['default']]): I/O error on GET request for "http://localhost:9191/user-service/default": Connection refused (Connect
    ion refused); nested exception is java.net.ConnectException: Connection refused (Connection refused)
    Failed to create instance of driver class org.hibernate.dialect.MySQL8Dialect, trying j
    dbcUrl resolution
    java.lang.ClassCastException: class org.hibernate.dialect.MySQL8Dialect cannot be cast to class java.sql.Driver (org.hibernate.dialect.MySQL8Dialect is in unnamed module of loader org.
    springframework.boot.loader.LaunchedURLClassLoader @2096442d; java.sql.Driver is in module java.sql of loader 'platform')
    Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
@Antero360 I couldn't get any feedback from you.
 
Here is the diagram of my project : Diagram
Here are some screenshots to show logs : Images
I'm trying to implement an example of Spring Cloud running in docker.
I can run all services in local but I cannot do that in docker.
again, can you please post the screenshot of them here rather than providing a link?
Also, did a bit more digging for ya, and found this nice step by step setup. Might wanna take a look to see if everything is configured correctly.
 
Last edited:
again, can you please post the screenshot of them here rather than providing a link?
Also, did a bit more digging for ya, and found this nice step by step setup. Might wanna take a look to see if everything is configured correctly.
You said can you please post the screenshot of them here rather than providing a link. How can I share nearly 60 images here?
I already shared all information about my issues with you.
I was nearly one week that you cannot answer my questions.
Now, is it possible to look through my docker-compose.yml and Dockerfiles of each services and properties file under configuration folder of config server.
 
You said can you please post the screenshot of them here rather than providing a link. How can I share nearly 60 images here?
I already shared all information about my issues with you.
I was nearly one week that you cannot answer my questions.
Now, is it possible to look through my docker-compose.yml and Dockerfiles of each services and properties file under configuration folder of config server.
@Antero360 I couldn't get any response from you.
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom