datdatyul
Active Coder
I have a problem about running docker-compose file through this command (`docker-compose up -d`).
After running the command, I noticed that 3 services (**advertisement service, user service and lastly report service**) cannot run. It throws an error when I try to see logs in each services through this command (`docker logs <container-id>`)
Here is the error : `org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set`
How can I fix it?
Here is my project link : [Link][1]
Here is my docker-compose.yml
services:
database:
container_name: mysql-database
image: 'mysql:latest'
ports:
- "3366:3306"
restart: always
environment:
#MYSQL_DATABASE: "springbootuser"
MYSQL_USER: "springmicroserviceuser"
MYSQL_PASSWORD: "111111"
MYSQL_ROOT_PASSWORD: "111111"
volumes:
- db-data:/var/lib/mysql
networks:
backend:
aliases:
- "database"
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
timeout: 20s
retries: 10
configserver:
image: configserver
container_name: configServer
build:
context: ./configserver
dockerfile: Dockerfile
ports:
- "9191:9191"
networks:
backend:
aliases:
- "configserver"
eurekaserver:
image: eurekaserver
ports:
- "8761:8761"
build:
context: ./discoveryserver
dockerfile: Dockerfile
depends_on:
configserver:
condition: service_started
networks:
backend:
aliases:
- "eurekaserver"
gatewayserver:
image: gatewayserver
ports:
- "8600:8600"
build:
context: ./api-gateway
dockerfile: Dockerfile
environment:
PROFILE: "default"
SERVER_PORT: "8600"
CONFIGSERVER_URI: "http://configserver:9191"
EUREKASERVER_URI: "http://eurekaserver:8761/eureka/"
EUREKASERVER_PORT: "8761"
CONFIGSERVER_PORT: "9191"
depends_on:
configserver:
condition: service_started
eurekaserver:
condition: service_started
networks:
backend:
aliases:
- "gateway"
userservice:
image: user-service
build:
context: ./user-service
dockerfile: Dockerfile
environment:
CONFIGSERVER_URI: "http://configserver:9191"
CONFIGSERVER_PORT: "9191"
SPRING_DATASOURCE_URL: "jdbc:mysql://database:3366/springbootuser?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Turkey"
SPRING_DATASOURCE_DRIVER_CLASS_NAME: "org.hibernate.dialect.MySQL8Dialect"
SPRING_DATASOURCE_USERNAME: "springmicroserviceuser"
SPRING_DATASOURCE_PASSWORD: "111111"
SPRING_JPA_HIBERNATE_DDL_AUTO: "update"
depends_on:
database:
condition: service_healthy
configserver:
condition: service_started
ports:
- "9000:9000"
networks:
- backend
managementservice:
image: management-service
build:
context: ./management-service
dockerfile: Dockerfile
environment:
CONFIGSERVER_URI: "http://configserver:9191"
CONFIGSERVER_PORT: "9191"
depends_on:
configserver:
condition: service_started
ports:
- "9002:9002"
networks:
- backend
advertisementservice:
image: advertisement-service
build:
context: ./advertisement-service
dockerfile: Dockerfile
environment:
CONFIGSERVER_URI: "http://configserver:9191"
CONFIGSERVER_PORT: "9191"
SPRING_DATASOURCE_URL: "jdbc:mysql://database:3366/springbootadvertisement?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Turkey"
SPRING_DATASOURCE_DRIVER_CLASS_NAME: "org.hibernate.dialect.MySQL8Dialect"
SPRING_DATASOURCE_USERNAME: "springmicroserviceuser"
SPRING_DATASOURCE_PASSWORD: "111111"
SPRING_JPA_HIBERNATE_DDL_AUTO: "update"
depends_on:
database:
condition: service_healthy
configserver:
condition: service_started
ports:
- "9001:9001"
networks:
- backend
reportservice:
image: report-service
build:
context: ./report-service
dockerfile: Dockerfile
environment:
CONFIGSERVER_URI: "http://configserver:9191"
CONFIGSERVER_PORT: "9191"
SPRING_DATASOURCE_URL: "jdbc:mysql://database:3366/springbootreport?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Turkey"
SPRING_DATASOURCE_DRIVER_CLASS_NAME: "org.hibernate.dialect.MySQL8Dialect"
SPRING_DATASOURCE_USERNAME: "springmicroserviceuser"
SPRING_DATASOURCE_PASSWORD: "111111"
SPRING_JPA_HIBERNATE_DDL_AUTO: "update"
depends_on:
database:
condition: service_healthy
configserver:
condition: service_started
ports:
- "9003:9003"
networks:
- backend
keycloak:
image: quay.io/keycloak/keycloak:18.0.2
environment:
- KEYCLOAK_ADMIN=admin
- KEYCLOAK_ADMIN_PASSWORD=admin
ports:
- "8181:8080"
networks:
backend:
aliases:
- "keycloak"
command:
- start-dev
rabbitmq:
image: "rabbitmq:3-management"
container_name: "rmq3"
environment:
RABBITMQ_DEFAULT_USER: "rabbitmq"
RABBITMQ_DEFAULT_PASS: "123456"
ports:
- "5672:5672"
- "15672:15672"
networks:
backend:
driver: bridge
volumes:
db-data:
[1]: https://github.com/Rapter1990/SpringBootMicroservices
After running the command, I noticed that 3 services (**advertisement service, user service and lastly report service**) cannot run. It throws an error when I try to see logs in each services through this command (`docker logs <container-id>`)
Here is the error : `org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set`
How can I fix it?
Here is my project link : [Link][1]
Here is my docker-compose.yml
services:
database:
container_name: mysql-database
image: 'mysql:latest'
ports:
- "3366:3306"
restart: always
environment:
#MYSQL_DATABASE: "springbootuser"
MYSQL_USER: "springmicroserviceuser"
MYSQL_PASSWORD: "111111"
MYSQL_ROOT_PASSWORD: "111111"
volumes:
- db-data:/var/lib/mysql
networks:
backend:
aliases:
- "database"
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
timeout: 20s
retries: 10
configserver:
image: configserver
container_name: configServer
build:
context: ./configserver
dockerfile: Dockerfile
ports:
- "9191:9191"
networks:
backend:
aliases:
- "configserver"
eurekaserver:
image: eurekaserver
ports:
- "8761:8761"
build:
context: ./discoveryserver
dockerfile: Dockerfile
depends_on:
configserver:
condition: service_started
networks:
backend:
aliases:
- "eurekaserver"
gatewayserver:
image: gatewayserver
ports:
- "8600:8600"
build:
context: ./api-gateway
dockerfile: Dockerfile
environment:
PROFILE: "default"
SERVER_PORT: "8600"
CONFIGSERVER_URI: "http://configserver:9191"
EUREKASERVER_URI: "http://eurekaserver:8761/eureka/"
EUREKASERVER_PORT: "8761"
CONFIGSERVER_PORT: "9191"
depends_on:
configserver:
condition: service_started
eurekaserver:
condition: service_started
networks:
backend:
aliases:
- "gateway"
userservice:
image: user-service
build:
context: ./user-service
dockerfile: Dockerfile
environment:
CONFIGSERVER_URI: "http://configserver:9191"
CONFIGSERVER_PORT: "9191"
SPRING_DATASOURCE_URL: "jdbc:mysql://database:3366/springbootuser?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Turkey"
SPRING_DATASOURCE_DRIVER_CLASS_NAME: "org.hibernate.dialect.MySQL8Dialect"
SPRING_DATASOURCE_USERNAME: "springmicroserviceuser"
SPRING_DATASOURCE_PASSWORD: "111111"
SPRING_JPA_HIBERNATE_DDL_AUTO: "update"
depends_on:
database:
condition: service_healthy
configserver:
condition: service_started
ports:
- "9000:9000"
networks:
- backend
managementservice:
image: management-service
build:
context: ./management-service
dockerfile: Dockerfile
environment:
CONFIGSERVER_URI: "http://configserver:9191"
CONFIGSERVER_PORT: "9191"
depends_on:
configserver:
condition: service_started
ports:
- "9002:9002"
networks:
- backend
advertisementservice:
image: advertisement-service
build:
context: ./advertisement-service
dockerfile: Dockerfile
environment:
CONFIGSERVER_URI: "http://configserver:9191"
CONFIGSERVER_PORT: "9191"
SPRING_DATASOURCE_URL: "jdbc:mysql://database:3366/springbootadvertisement?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Turkey"
SPRING_DATASOURCE_DRIVER_CLASS_NAME: "org.hibernate.dialect.MySQL8Dialect"
SPRING_DATASOURCE_USERNAME: "springmicroserviceuser"
SPRING_DATASOURCE_PASSWORD: "111111"
SPRING_JPA_HIBERNATE_DDL_AUTO: "update"
depends_on:
database:
condition: service_healthy
configserver:
condition: service_started
ports:
- "9001:9001"
networks:
- backend
reportservice:
image: report-service
build:
context: ./report-service
dockerfile: Dockerfile
environment:
CONFIGSERVER_URI: "http://configserver:9191"
CONFIGSERVER_PORT: "9191"
SPRING_DATASOURCE_URL: "jdbc:mysql://database:3366/springbootreport?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Turkey"
SPRING_DATASOURCE_DRIVER_CLASS_NAME: "org.hibernate.dialect.MySQL8Dialect"
SPRING_DATASOURCE_USERNAME: "springmicroserviceuser"
SPRING_DATASOURCE_PASSWORD: "111111"
SPRING_JPA_HIBERNATE_DDL_AUTO: "update"
depends_on:
database:
condition: service_healthy
configserver:
condition: service_started
ports:
- "9003:9003"
networks:
- backend
keycloak:
image: quay.io/keycloak/keycloak:18.0.2
environment:
- KEYCLOAK_ADMIN=admin
- KEYCLOAK_ADMIN_PASSWORD=admin
ports:
- "8181:8080"
networks:
backend:
aliases:
- "keycloak"
command:
- start-dev
rabbitmq:
image: "rabbitmq:3-management"
container_name: "rmq3"
environment:
RABBITMQ_DEFAULT_USER: "rabbitmq"
RABBITMQ_DEFAULT_PASS: "123456"
ports:
- "5672:5672"
- "15672:15672"
networks:
backend:
driver: bridge
volumes:
db-data:
[1]: https://github.com/Rapter1990/SpringBootMicroservices