flywa报错Detected resolved migration not applied to database: 20221103.10000

简介: flywa报错Detected resolved migration not applied to database: 20221103.10000

1.jpeg

详情错误日志

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.6.3)

2022-11-02 09:54:21.609  INFO 11444 --- [           main] com.flyway.FlaywayApplication            : Starting FlaywayApplication using Java 1.8.0_71 on HYT211145187-01 with PID 11444 (G:\WorkSpace\springboot-test\flyway-test\target\classes started by 211145187 in G:\WorkSpace\springboot-test)
2022-11-02 09:54:21.613  INFO 11444 --- [           main] com.flyway.FlaywayApplication            : No active profile set, falling back to default profiles: default
2022-11-02 09:54:22.684  INFO 11444 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8015 (http)
2022-11-02 09:54:22.694  INFO 11444 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-11-02 09:54:22.694  INFO 11444 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.56]
2022-11-02 09:54:22.781  INFO 11444 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-11-02 09:54:22.781  INFO 11444 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1124 ms
2022-11-02 09:54:23.171  INFO 11444 --- [           main] o.f.c.internal.license.VersionPrinter    : Flyway Community Edition 6.5.7 by Redgate
2022-11-02 09:54:23.176  INFO 11444 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariCP - Starting...
2022-11-02 09:54:33.502  INFO 11444 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariCP - Start completed.
2022-11-02 09:54:33.519  INFO 11444 --- [           main] o.f.c.internal.database.DatabaseFactory  : Database: jdbc:mysql://10.110.13.86:3306/flyway (MySQL 5.7)
2022-11-02 09:54:33.585  WARN 11444 --- [           main] ConfigServletWebServerApplicationContext : 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 java.lang.reflect.InvocationTargetException
2022-11-02 09:54:33.585  INFO 11444 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariCP - Shutdown initiated...
2022-11-02 09:54:33.589  INFO 11444 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariCP - Shutdown completed.
2022-11-02 09:54:33.592  INFO 11444 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2022-11-02 09:54:33.602  INFO 11444 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-11-02 09:54:33.632 ERROR 11444 --- [           main] o.s.boot.SpringApplication               : 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 java.lang.reflect.InvocationTargetException
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.15.jar:5.3.15]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.15.jar:5.3.15]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.15.jar:5.3.15]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.15.jar:5.3.15]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.15.jar:5.3.15]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.15.jar:5.3.15]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.15.jar:5.3.15]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.3.15.jar:5.3.15]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.15.jar:5.3.15]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953) ~[spring-beans-5.3.15.jar:5.3.15]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.15.jar:5.3.15]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.15.jar:5.3.15]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.3.jar:2.6.3]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) [spring-boot-2.6.3.jar:2.6.3]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:414) [spring-boot-2.6.3.jar:2.6.3]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) [spring-boot-2.6.3.jar:2.6.3]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) [spring-boot-2.6.3.jar:2.6.3]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) [spring-boot-2.6.3.jar:2.6.3]
    at com.flyway.FlaywayApplication.main(FlaywayApplication.java:14) [classes/:na]
Caused by: java.lang.reflect.InvocationTargetException: null
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_71]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_71]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_71]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_71]
    at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:70) ~[spring-boot-autoconfigure-2.6.3.jar:2.6.3]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.15.jar:5.3.15]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.15.jar:5.3.15]
    ... 18 common frames omitted
Caused by: org.flywaydb.core.api.FlywayException: Validate failed: 
Detected resolved migration not applied to database: 20221103.10000

    at org.flywaydb.core.Flyway.doValidate(Flyway.java:292) ~[flyway-core-6.5.7.jar:na]
    at org.flywaydb.core.Flyway.access$100(Flyway.java:73) ~[flyway-core-6.5.7.jar:na]
    at org.flywaydb.core.Flyway$1.execute(Flyway.java:166) ~[flyway-core-6.5.7.jar:na]
    at org.flywaydb.core.Flyway$1.execute(Flyway.java:158) ~[flyway-core-6.5.7.jar:na]
    at org.flywaydb.core.Flyway.execute(Flyway.java:527) ~[flyway-core-6.5.7.jar:na]
    at org.flywaydb.core.Flyway.migrate(Flyway.java:158) ~[flyway-core-6.5.7.jar:na]
    ... 25 common frames omitted


Process finished with exit code 1

错误原因:sql版本校验没过,正常情况一般是版本命名不规范,修改sql版本即可。

场景复现:我先创建个V20221103_10001add_flyway_test_table.sql的文件,执行版本迁移成功,然后我创建个V20221103_10000add_flyway_test_table.sql发下失败,明显是双下划线前面的版本不规范造成的。

详情请看我的博客:↓

springboot使用flyway,使用介绍、个人总结及报错场景如何修改

目录
相关文章
|
2月前
|
关系型数据库 MySQL Java
flywa报错java.sql.SQLSyntaxErrorException: Unknown database ‘flyway‘
flywa报错java.sql.SQLSyntaxErrorException: Unknown database ‘flyway‘
35 1
|
2月前
|
SQL Java Maven
flywa报错Migration checksum mismatch for migration version 1.1 -> Applied to database : 1332862643 ->
flywa报错Migration checksum mismatch for migration version 1.1 -> Applied to database : 1332862643 ->
38 1
|
1月前
|
安全 关系型数据库 MySQL
openvas报错Warning: Secinfo Database Missing SCAP and/or CERT database missing on OMP server.
openvas报错Warning: Secinfo Database Missing SCAP and/or CERT database missing on OMP server.
|
6月前
|
Oracle 关系型数据库 数据库
实时计算 Flink版操作报错合集之错误信息"ORA-65040: operation not allowed from within a pluggable database"如何解决
在使用实时计算Flink版过程中,可能会遇到各种错误,了解这些错误的原因及解决方法对于高效排错至关重要。针对具体问题,查看Flink的日志是关键,它们通常会提供更详细的错误信息和堆栈跟踪,有助于定位问题。此外,Flink社区文档和官方论坛也是寻求帮助的好去处。以下是一些常见的操作报错及其可能的原因与解决策略。
330 2
|
6月前
|
消息中间件 Oracle 关系型数据库
实时计算 Flink版操作报错合集之报错io.debezium.DebeziumException: The db history topic or its content is fully or partially missing. Please check database history topic configuration and re-execute the snapshot. 是什么原因
在使用实时计算Flink版过程中,可能会遇到各种错误,了解这些错误的原因及解决方法对于高效排错至关重要。针对具体问题,查看Flink的日志是关键,它们通常会提供更详细的错误信息和堆栈跟踪,有助于定位问题。此外,Flink社区文档和官方论坛也是寻求帮助的好去处。以下是一些常见的操作报错及其可能的原因与解决策略。
351 0
|
6月前
|
SQL Oracle 关系型数据库
WARNING: Too Many Parse Errors With error=911 When Running a JDBC Application Connected to an Oracle 19c database
WARNING: Too Many Parse Errors With error=911 When Running a JDBC Application Connected to an Oracle 19c database (
91 2
|
6月前
|
Oracle 关系型数据库
19c 开启Oracle Database Vault
19c 开启Oracle Database Vault
162 1
|
6月前
|
SQL Oracle 关系型数据库
Connect to Autonomous Database Using Oracle Database Tools
Connect to Autonomous Database Using Oracle Database Tools
61 1
|
5月前
|
Oracle 关系型数据库 Linux
Requirements for Installing Oracle Database/Client 19c on OL8 or RHEL8 64-bit (x86-64) (Doc ID 2668780.1)
Requirements for Installing Oracle Database/Client 19c on OL8 or RHEL8 64-bit (x86-64) (Doc ID 2668780.1)
47 0
|
6月前
|
人工智能 Oracle 关系型数据库
一篇文章弄懂Oracle和PostgreSQL的Database Link
一篇文章弄懂Oracle和PostgreSQL的Database Link