SaiUpadhyayula / spring-boot-microservices

This repository contains the latest source code of th spring-boot-microservices tutorial
903 stars 680 forks source link

Hibernate Dialect Issue: java.lang.IllegalStateException: Failed to load ApplicationContext for [WebMergedContextConfiguratio #13

Open joyryder opened 1 year ago

joyryder commented 1 year ago

Whenever I run the mvn test I get the following error:

[ERROR] contextLoads Time elapsed: 0.002 s <<< ERROR! java.lang.IllegalStateException: Failed to load ApplicationContext for [WebMergedContextConfiguration@70139a81 testClass = com.programmingtechie.inventoryservice.InventoryServiceApplicationTests, locations = [], classes = [com.programmingtechie.inventoryservice.InventoryServiceApplication], contextInitializerClasses = [], activeProfiles = [], propertySourceLocations = [], propertySourceProperties = ["org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true"], contextCustomizers = [org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@742ff096, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@79e4c792, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@5b218417, org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@9da1, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@7188af83, org.springframework.boot.test.context.SpringBootTestAnnotation@223fe7d3], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: 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: Unable to determine Dialect without JDBC metadata (please set 'javax.persistence.jdbc.url', 'hibernate.connection.url', or 'hibernate.dialect')

This is issue is not going away, please let me know how I can resolve this issue

serdaroguzhanakin commented 1 year ago

add this one; spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect