Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does flyway 6.0.0-beta work well with Java12 or Spring boot 2.1.3? #2333

Closed
chiahualiu77 opened this issue Mar 20, 2019 · 5 comments
Closed

Comments

@chiahualiu77
Copy link

chiahualiu77 commented Mar 20, 2019

Which version and edition of Flyway are you using?

I'm using Flyway 6.0.0-beta under Java12 env.

If this is not the latest version, can you reproduce the issue with the latest one as well?

(Many bugs are fixed in newer releases and upgrading will often resolve the issue)
When I run ./gradlew bootRun, I got this Exception java.lang.ClassNotFoundException: org.flywaydb.core.api.callback.FlywayCallback

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)

run ./gradlew bootRun on terminal.
Java 12
Gradle 5.2.1

Which database are you using (type & version)?

Postgres 11.2

Which operating system are you using?

MacOs

What did you do?

(Please include the content causing the issue, any relevant configuration settings, the SQL statement that failed (if relevant) and the command you ran.)
I'm using Java12 and flyway 6.0.0-beta.
The gradle config I set:

buildscript {
    ext {
        springBootVersion = '2.1.3.RELEASE'
    }
    repositories {
        mavenCentral()
        maven { url "https://repo.spring.io/snapshot" }
        maven { url "https://repo.spring.io/milestone" }
    }
    dependencies {
        classpath(
                classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"),
                classpath("org.springframework:springloaded:1.2.4.RELEASE")
        )
    }
}
plugins {
    id 'java'
    id "org.sonarqube" version "2.7"
    id 'org.flywaydb.flyway' version "6.0.0-beta"
}
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'maven-publish'

dependencies {
    implementation(
            'org.springframework.boot:spring-boot-starter-actuator',
            'org.springframework.boot:spring-boot-configuration-processor',
            'org.springframework.boot:spring-boot-starter-data-jpa',
            'org.springframework.boot:spring-boot-starter-web',
            'org.springframework.boot:spring-boot-starter-batch',
            "org.postgresql:postgresql:42.2.5",
            'org.flywaydb:flyway-core:6.0.0-beta',
    )
}

The following is the error:

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:528)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:392)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1305)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1144)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:307)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
        at com.radius.shore.ShoreApplication.main(ShoreApplication.java:15)
Caused by: java.lang.TypeNotPresentException: Type org.flywaydb.core.api.callback.FlywayCallback not present
        at java.base/sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:117)
        at java.base/sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
        at java.base/sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
        at java.base/sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68)
        at java.base/sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138)
        at java.base/sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
        at java.base/sun.reflect.generics.repository.ConstructorRepository.computeParameterTypes(ConstructorRepository.java:111)
        at java.base/sun.reflect.generics.repository.ConstructorRepository.getParameterTypes(ConstructorRepository.java:87)
        at java.base/java.lang.reflect.Executable.getGenericParameterTypes(Executable.java:283)
        at java.base/java.lang.reflect.Constructor.getGenericParameterTypes(Constructor.java:281)
        at org.springframework.core.MethodParameter.getGenericParameterType(MethodParameter.java:428)
        at org.springframework.core.SerializableTypeWrapper$MethodParameterTypeProvider.getType(SerializableTypeWrapper.java:291)
        at org.springframework.core.SerializableTypeWrapper.forTypeProvider(SerializableTypeWrapper.java:106)
        at org.springframework.core.ResolvableType.forType(ResolvableType.java:1401)
        at org.springframework.core.ResolvableType.forMethodParameter(ResolvableType.java:1309)
        at org.springframework.core.ResolvableType.forMethodParameter(ResolvableType.java:1275)
        at org.springframework.beans.factory.config.DependencyDescriptor.getResolvableType(DependencyDescriptor.java:316)
        at org.springframework.beans.factory.support.GenericTypeAwareAutowireCandidateResolver.checkGenericTypeMatch(GenericTypeAwareAutowireCandidateResolver.java:77)
        at org.springframework.beans.factory.support.GenericTypeAwareAutowireCandidateResolver.isAutowireCandidate(GenericTypeAwareAutowireCandidateResolver.java:69)
        at org.springframework.beans.factory.annotation.QualifierAnnotationAutowireCandidateResolver.isAutowireCandidate(QualifierAnnotationAutowireCandidateResolver.java:147)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.isAutowireCandidate(DefaultListableBeanFactory.java:764)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.isAutowireCandidate(DefaultListableBeanFactory.java:727)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.isAutowireCandidate(DefaultListableBeanFactory.java:711)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1426)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1210)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1167)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:857)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:760)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:218)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1325)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1171)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
        ... 25 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.flywaydb.core.api.callback.FlywayCallback
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:415)
        at java.base/sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
        ... 57 common frames omitted

I'm not sure it's related to my JDBC driver or Java version or Spring version...
But if I downgrade flyway to 5.2.4 and then run the application, the flyway schema history table will be created. Thank you!

What did you expect to see?

The flyway schema history table will be created.

What did you see instead?

java.lang.ClassNotFoundException: org.flywaydb.core.api.callback.FlywayCallback

@chiahualiu77 chiahualiu77 changed the title Does flyway 6.0.0-beta work well with Java12? Does flyway 6.0.0-beta work well with Java12 or Spring boot 2.1.3? Mar 20, 2019
@axelfontaine
Copy link
Contributor

axelfontaine commented Mar 20, 2019

Spring Boot is not yet compatible with Flyway 6.0. They will be compatible once 6.0 goes GA.

@geoffreywiseman
Copy link

geoffreywiseman commented Aug 19, 2019

Flyway 6 is GA now (I assume), and Spring Boot still not compatible on a quick scan? GitHub Dependabot picked up Flyway 6 this morning, and I got the same error? I'm no no rush, so it's not a big deal, but if there's an update about the support for Spring Boot, might be a good idea to put new information here.

@pzoladek
Copy link

I've been futilely fighting with Flyway for the last 3 days. It made me really frustrated and I find info in this issue very useful - finally changed version from 6.0 to 5.2.4 and everything is clear now.
Thanks for an important issue.

@geoffreywiseman
Copy link

FWIW, the Spring Boot issue relating to this is:
spring-projects/spring-boot#15446

Sounds like there are still some issues to work out.

@geoffreywiseman
Copy link

Ok, sounds like this'll be resolved in Spring Boot 2.2.0: spring-projects/spring-boot#17993

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants