Hi,
I have a problem about running docker-compose.yml file in my Spring Boot Microservice.
I got an error when user service tried to build.
Here is the error shown below.
org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
How can I fix it?
Here is my properties file of user service shown below.
spring.datasource.url=jdbc:mysql://localhost:3306/springbootuser?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Turkey
spring.datasource.username=springmicroserviceuser
spring.datasource.password=111111
# Define hibernate settings (JPA / Hibernate properties)
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
server.port=9000
spring.application.name=user-service
eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka
keycloak.realm=master
keycloak.auth-server-url=http://localhost:8181
keycloak.ssl-required=external
keycloak.resource=spring-boot-microservice-keycloak
keycloak.bearer-only=true
keycloak.public-client=true
Here is the relevant code snippets of docker-compose covering eureka server, config server, api gateway and user service.
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"
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"
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"
userservice:
image: user-service
build:
context: ./user-service
dockerfile: Dockerfile
environment:
SERVER_PORT: "9000"
CONFIGSERVER_URI: "http://localhost:9191"
CONFIGSERVER_PORT: "9191"
EUREKASERVER_URI: "http://localhost:8761/eureka/"
EUREKASERVER_PORT: "8761"
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
Here are some screenshots to show logs : Link
Here is the docker-compose.yml : Link