Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/

十点数据 1年前 ⋅ 7082 阅读

错误信息如下: `

Spring Boot : 2.2.6.RELEASE mblog : 4.0.0 mblog storage : E:\WorkSpace\mblog

2021-07-06 01:39:59 [restartedMain] INFO c.m.mblog.BootApplication:55 Starting BootApplication on LAPTOP-35BFBJAV with PID 15852 (E:\WorkSpace\mblog\target\classes started by fy in E:\WorkSpace\mblog) 2021-07-06 01:39:59 [restartedMain] INFO c.m.mblog.BootApplication:655 The following profiles are active: dev 2021-07-06 01:40:37 [restartedMain] INFO o.a.s.c.e.EhCacheManager:158 Cache with name 'com.mtons.mblog.shiro.AccountRealm.authorizationCache' does not yet exist. Creating now. 2021-07-06 01:40:37 [restartedMain] INFO o.a.s.c.e.EhCacheManager:165 Added EhCache named [com.mtons.mblog.shiro.AccountRealm.authorizationCache] 2021-07-06 01:40:43 [restartedMain] WARN i.undertow.websockets.jsr:68 UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used 2021-07-06 01:40:44 [restartedMain] INFO io.undertow.servlet:364 Initializing Spring embedded WebApplicationContext 2021-07-06 01:40:45 [restartedMain] INFO c.z.h.HikariDataSource:110 HikariPool-1 - Starting... 2021-07-06 01:40:48 [restartedMain] INFO c.z.h.HikariDataSource:123 HikariPool-1 - Start completed. 2021-07-06 01:40:50 [restartedMain] INFO o.f.c.i.l.VersionPrinter:49 Flyway Community Edition 5.2.4 by Boxfuse 2021-07-06 01:40:50 [restartedMain] INFO o.f.c.i.d.DatabaseFactory:49 Database: jdbc:mysql://xxx.xxx.xxx.xxx:xxx/xxxxx (MySQL 5.5) 2021-07-06 01:40:51 [restartedMain] WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext:558 Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Validate failed: Detected failed migration to version 3.2 (update) 2021-07-06 01:40:51 [restartedMain] INFO c.z.h.HikariDataSource:350 HikariPool-1 - Shutdown initiated... 2021-07-06 01:40:51 [restartedMain] INFO c.z.h.HikariDataSource:352 HikariPool-1 - Shutdown completed. 2021-07-06 01:40:51 [restartedMain] ERROR o.s.b.SpringApplication:826 Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Validate failed: Detected failed migration to version 3.2 (update) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$185/651765834.getObject(Unknown Source) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1108) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) at com.mtons.mblog.BootApplication.main(BootApplication.java:19) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) Caused by: org.flywaydb.core.api.FlywayException: Validate failed: Detected failed migration to version 3.2 (update) at org.flywaydb.core.Flyway.doValidate(Flyway.java:1482) at org.flywaydb.core.Flyway.access$100(Flyway.java:85) at org.flywaydb.core.Flyway$1.execute(Flyway.java:1364) at org.flywaydb.core.Flyway$1.execute(Flyway.java:1356) at org.flywaydb.core.Flyway.execute(Flyway.java:1711) at org.flywaydb.core.Flyway.migrate(Flyway.java:1356) at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:65) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792) ... 24 common frames omitted `

解决方案:

jdbc:mysql://mysql:3306/scdf?useMysqlMetadata=true

加上useMysqlMetadata=true即可

全部评论: 0

    我有话说: