flyway报错Correct the classpath of your application so that it contains compatible versions of the

简介: flyway报错Correct the classpath of your application so that it contains compatible versions of the

1.jpeg

详情错误日志

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

2022-11-01 10:52:01.616  INFO 26424 --- [           main] com.flyway.FlaywayApplication            : Starting FlaywayApplication using Java 11.0.12 on HYT211145187-01 with PID 26424 (G:\WorkSpace\springboot-test\flyway-test\target\classes started by 211145187 in G:\WorkSpace\springboot-test)
2022-11-01 10:52:01.619  INFO 26424 --- [           main] com.flyway.FlaywayApplication            : No active profile set, falling back to default profiles: default
2022-11-01 10:52:02.677  INFO 26424 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8015 (http)
2022-11-01 10:52:02.691  INFO 26424 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-11-01 10:52:02.691  INFO 26424 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.56]
2022-11-01 10:52:02.778  INFO 26424 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-11-01 10:52:02.779  INFO 26424 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1070 ms
2022-11-01 10:52:03.148  WARN 26424 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flyway' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.flywaydb.core.Flyway]: Factory method 'flyway' threw exception; nested exception is java.lang.NoSuchMethodError: org.flywaydb.core.api.configuration.FluentConfiguration.ignoreMissingMigrations(Z)Lorg/flywaydb/core/api/configuration/FluentConfiguration;
2022-11-01 10:52:03.151  INFO 26424 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2022-11-01 10:52:03.161  INFO 26424 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-11-01 10:52:03.177 ERROR 26424 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration.configureIgnoredMigrations(FlywayAutoConfiguration.java:273)

The following method did not exist:

    org.flywaydb.core.api.configuration.FluentConfiguration.ignoreMissingMigrations(Z)Lorg/flywaydb/core/api/configuration/FluentConfiguration;

The calling method's class, org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration, was loaded from the following location:

    jar:file:/F:/apache-maven-3.6.3/repository/org/springframework/boot/spring-boot-autoconfigure/2.6.3/spring-boot-autoconfigure-2.6.3.jar!/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class

The called method's class, org.flywaydb.core.api.configuration.FluentConfiguration, is available from the following locations:

    jar:file:/F:/apache-maven-3.6.3/repository/org/flywaydb/flyway-core/9.6.0/flyway-core-9.6.0.jar!/org/flywaydb/core/api/configuration/FluentConfiguration.class

The called method's class hierarchy was loaded from the following locations:

    org.flywaydb.core.api.configuration.FluentConfiguration: file:/F:/apache-maven-3.6.3/repository/org/flywaydb/flyway-core/9.6.0/flyway-core-9.6.0.jar


Action:

Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration and org.flywaydb.core.api.configuration.FluentConfiguration

错误原因:pom中flyway-core的依赖版本问题,当设置9.6.0时就报这个错误,但当设置6.5.7时就能正常启动,感觉是flyway高版本和springboot2.x版本不匹配的问题导致的问题,具体为啥目前不清楚,只要把flyway版本设置成5.2.1或者6.5.7版本以及之间的版本那都是可以运行的。

第1步:引入pom

<!--使用flyway-->
<dependency>
    <groupId>org.flywaydb</groupId>
    <artifactId>flyway-core</artifactId>
    <version>${
   flayway.test.version}</version>
</dependency>

我的项目是父模块模式,所以版本号在父pom中指定

<properties>
    <flayway.test.version>6.5.7</flayway.test.version>    
</properties>

详情请看我的博客:↓

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

目录
相关文章
|
4月前
|
Java 数据库连接 Apache
Correct the classpath of your application so that it contains compatible versions of the classes com
Correct the classpath of your application so that it contains compatible versions of the classes com
|
缓存 Ubuntu Java
‘settings.xml’ has syntax errors less… 和Parent ‘org.springframework.boot’has problems less…的问题解决
‘settings.xml’ has syntax errors less… 和Parent ‘org.springframework.boot’has problems less…的问题解决
400 0
‘settings.xml’ has syntax errors less… 和Parent ‘org.springframework.boot’has problems less…的问题解决
|
4月前
|
存储 供应链 搜索推荐
Spartacus product variant configuration sample data
Spartacus product variant configuration sample data
|
4月前
|
Java
Version 1.8.0_201 of the JVM is not suitable for this product. Version: 11 or greater is required.
Version 1.8.0_201 of the JVM is not suitable for this product. Version: 11 or greater is required.
92 0
使用pageHelper报错 Type definition error: [simple type, classXXXX]
使用pageHelper报错 Type definition error: [simple type, classXXXX]
No matching configuration of project :libusb was found.
No matching configuration of project :libusb was found.
588 0
How is target My note application rendered - renderManager
Created by Wang, Jerry, last modified on May 18, 2015
115 0
How is target My note application rendered - renderManager
Error This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, se
错误提示: Severity Code Description Project File Line Suppression StateError This project references NuGet package(s) that are missing on this computer.
1026 0