How to Solve Error Message Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set

Posted on

Introduction

This article is focusing on how to solve an error message. The error message appear when building and compiling a Java-based application in a Netbeans IDE. The Java-based application is using Spring Boot and Hibernate framework. The error appear in the log file of the standalone.bat execution as follows :

{"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"admin-starter.war\".undertow-deployment" => "java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
    Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
    Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
    Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set"}}

In order to keep it short, just look at the last line of the log output as follows :

Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set"}}

So, the actual cause is  the ‘hibernate.dialect’ is not set at all. Just try to set the value of the hibernate.dialect property in the Java-based application.

Solution

So, how to solve the problem appear in the error message. Actually, the solution is very simple. It appears also as a link in another article. That article is the article with the title of ‘[Solved] org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set’ in this link. Just add the following line in the application.properties file since it is a Java-based application using Spring Boot framework :

spring.jpa.database-platform=org.hibernate.dialect

Just fill the above line with the corresponding value according to the database which the Java-based application is using. For an example if it is a MySQL database server, the value of the ‘spring.jpa.database-platform’ will be as follows :

spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect

Leave a Reply