Get the App
SLTechnology News&Howtos  ›  Development  › 

How to solve the problem of springboot startup failure

Shulou Source: shulou.com Published: 2022-06-02 04:55:12 10月04日 Update

This article mainly introduces how to solve the problem of springboot startup failure, the article is very detailed, has a certain reference value, interested friends must read it!

The problem of springboot startup failure

The springboot version is 1.3.0.M1, the connected mysql version is 8, and the database is run with spring-boot-starter-data-jpa.

The error in starting springboot is as follows

2018-02-21 11 ationConfigEmbeddedWebApplicationContext 25 WARN 47.637 12992-[main] ationConfigEmbeddedWebApplicationContext: Exception encountered during context initialization-cancelling refresh attempt

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.HibernateException: Access to DialectResolutionInfo cannot be null when' hibernate.dialect' not set

At org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean (AbstractAutowireCapableBeanFactory.java:1578)

At org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:545)

At org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:482)

At org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject (AbstractBeanFactory.java:304)

At org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:230)

At org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (AbstractBeanFactory.java:300)

At org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:195)

At org.springframework.context.support.AbstractApplicationContext.getBean (AbstractApplicationContext.java:1011)

At org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization (AbstractApplicationContext.java:802)

At org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:521)

At org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh (EmbeddedWebApplicationContext.java:118)

At org.springframework.boot.SpringApplication.refresh (SpringApplication.java:678)

At org.springframework.boot.SpringApplication.doRun (SpringApplication.java:339)

At org.springframework.boot.SpringApplication.run (SpringApplication.java:274)

At org.springframework.boot.SpringApplication.run (SpringApplication.java:931)

At org.springframework.boot.SpringApplication.run (SpringApplication.java:920)

At com.business.backend.BizApplication.main (BizApplication.java:122)

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

At org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect (DialectFactoryImpl.java:104)

At org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect (DialectFactoryImpl.java:71)

At org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure (JdbcServicesImpl.java:205)

At org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService (StandardServiceRegistryImpl.java:111)

At org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService (AbstractServiceRegistryImpl.java:234)

At org.hibernate.service.internal.AbstractServiceRegistryImpl.getService (AbstractServiceRegistryImpl.java:206)

At org.hibernate.cfg.Configuration.buildTypeRegistrations (Configuration.java:1887)

At org.hibernate.cfg.Configuration.buildSessionFactory (Configuration.java:1845)

At org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform (EntityManagerFactoryBuilderImpl.java:857)

At org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform (EntityManagerFactoryBuilderImpl.java:850)

At org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl (ClassLoaderServiceImpl.java:425)

At org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build (EntityManagerFactoryBuilderImpl.java:849)

At org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory (SpringHibernateJpaPersistenceProvider.java:60)

At org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory (LocalContainerEntityManagerFactoryBean.java:343)

At org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet (AbstractEntityManagerFactoryBean.java:318)

At org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods (AbstractAutowireCapableBeanFactory.java:1637)

At org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean (AbstractAutowireCapableBeanFactory.java:1574)

... 16 common frames omitted

2018-02-21 11 o.apache.catalina.core.StandardService 25 INFO 47.647 12992-[main] o.apache.catalina.core.StandardService: Stopping service Tomcat

This is the key sentence:

Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set

It turns out that the Hibernate SQL dialect is not set, so add the following line to the properties file:

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

Start springboot again. This time it's a success.

Hibernate SQL dialects are sorted out as shown in the following table. Dialect DB2org.hibernate.dialect.DB2DialectDB2 AS/400org.hibernate.dialect.DB2400DialectDB2 OS390org.hibernate.dialect.DB2390DialectPostgreSQLorg.hibernate.dialect.PostgreSQLDialectMySQLorg.hibernate.dialect.MySQLDialectMySQL with InnoDBorg.hibernate.dialect.MySQLInnoDBDialectMySQL with MyISAMorg.hibernate.dialect.MySQLMyISAMDialectOracle (any version) org.hibernate.dialect.OracleDialectOracle 9i/10gorg.hibernate.dialect.Oracle9DialectSybaseorg.hibernate.dialect.SybaseDialectSybase Anywhereorg.hibernate.dialect.SybaseAnywhereDialectMicrosoft SQL Serverorg.hibernate.dialect.SQLServerDialectSAP DBorg.hibernate.dialect.SAPDBDialectInformixorg.hibernate.dialect.InformixDialectHypersonicSQLorg .hibernate.dialect.HSQLDialectIngpromog.hibernate.dialect.IngresDialectProgressorg.hibernate.dialect.ProgressDialectMckoi SQLorg.hibernate.dialect.MckoiDialectInterbaseorg.hibernate.dialect.InterbaseDialectPointbaseorg.hibernate.dialect.PointbaseDialectFrontBaseorg.hibernate.dialect.FrontbaseDialectFirebirdorg.hibernate.dialect.FirebirdDialectspringboot appears' hibernate.dialect'not set

Write down these two items in application.properties

Double insurance!

Spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialectspring.jpa.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect above is all the contents of this article entitled "how to solve the problem of springboot startup failure". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Questions dialects content data databases versions articles success value keys interests guys partners documents more knowledge industry information channels channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple macOS OPPO Reno Shulou Information Docker