Unsupported Database: MySQL 8.0

vifengvifeng Posts: 6 New member
edited April 25, 2024 8:24AM in Flyway (General Discussion)
Which version and edition of Flyway are you using?
Flyway Community 8.2.1

Which client are you using? 
Gradle Version: 8.2.1 plugin
or
Flyway OSS Edition 10.11.1 by Redgate in command line

Which database are you using? (Type & version)
Mysql on google cloud sql MySQL 8.0.31

Which operating system are you using?
Mac
later i will be using docker with linux (please suggest anything that could help or an example. Thanks)


What did you do? 
I'm a beguinner working on my own, thank you for your comprehension and being very clear.
I was on h2 and migrated to gcp mysql. I had trouble with the no database found error when running `flyway clean` or `gradle flywayClean` it has been corrected and is running ok. I also use a `/Users/.../[project]/flyway.conf` to connect to the database. Since this problem has been cleared I run `gradle bootRun` and it doesn't work :(

here is my build.gradle.kts
<div>```kts</div><div>plugins {</div><div>&nbsp; &nbsp; id("java")</div><div>&nbsp; &nbsp; id("org.springframework.boot") version "3.2.5"&nbsp;</div><div>&nbsp; &nbsp; id("io.spring.dependency-management") version "1.1.4"</div><div>&nbsp; &nbsp; id("org.asciidoctor.jvm.convert") version "3.3.2"</div><div>&nbsp; &nbsp; id("com.diffplug.spotless") version "6.25.0"</div><div>&nbsp; &nbsp; id("org.flywaydb.flyway") version "10.11.1"</div><div>}</div><div><br></div><div>dependencyManagement {</div><div>&nbsp; &nbsp; imports {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; mavenBom(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)</div><div>&nbsp; &nbsp; }</div><div>}</div><div><br></div><div>group = "com.vf"</div><div>version = "0.0.1-SNAPSHOT"</div><div><br></div><div>java {</div><div>&nbsp; &nbsp; sourceCompatibility = JavaVersion.VERSION_17</div><div>}</div><div><br></div><div>springBoot {</div><div>&nbsp; &nbsp; mainClass.set("com.vf.eventhubserver.EventhubServerApplication")</div><div>}</div><div><br></div><div>configurations {</div><div>&nbsp; &nbsp; compileOnly {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; extendsFrom(configurations.annotationProcessor.get())</div><div>&nbsp; &nbsp; }</div><div>}</div><div>repositories {</div><div>&nbsp; &nbsp; mavenCentral()</div><div>&nbsp; &nbsp; maven {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; url = uri("https://download.red-gate.com/maven/release")</div><div>&nbsp; &nbsp; }</div><div>}</div><div><br></div><div>buildscript {</div><div>&nbsp; &nbsp; repositories {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; mavenCentral()</div><div>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; dependencies {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; classpath("org.flywaydb:flyway-mysql:10.11.1")</div><div>&nbsp; &nbsp; }</div><div>}</div><div><br></div><div>val snippetsDir by extra { file("build/generated-snippets") }</div><div>val asciidoctorExt by configurations.creating</div><div><br></div><div><br></div><div>dependencies {</div><div>&nbsp; &nbsp; implementation(platform("com.google.cloud:spring-cloud-gcp-dependencies:4.1.4"))</div><div>&nbsp; &nbsp; implementation("com.google.cloud:spring-cloud-gcp-starter-sql-mysql")</div><div>&nbsp; &nbsp; implementation("com.google.cloud:google-cloud-secretmanager")</div><div><br></div><div>&nbsp; &nbsp; implementation ("mysql:mysql-connector-java:8.0.31")</div><div>&nbsp; &nbsp; implementation("org.flywaydb:flyway-core:10.11.1")</div><div><br></div><div>&nbsp; &nbsp; implementation ("com.google.code.findbugs:jsr305:3.0.2")</div><div>&nbsp; &nbsp; implementation("org.springframework.data:spring-data-rest-hal-explorer")</div><div>&nbsp; &nbsp; asciidoctorExt("org.springframework.restdocs:spring-restdocs-asciidoctor")</div><div>&nbsp; &nbsp; implementation("org.springframework.boot:spring-boot-starter-actuator")</div><div>&nbsp; &nbsp; implementation("org.springframework.boot:spring-boot-starter-data-jpa")</div><div>&nbsp; &nbsp; implementation("org.springframework.boot:spring-boot-starter-validation")</div><div>&nbsp; &nbsp; implementation("org.springframework.boot:spring-boot-starter-web")</div><div>&nbsp; &nbsp; implementation("org.springframework.boot:spring-boot-starter-webflux")</div><div>&nbsp; &nbsp; implementation("org.springframework.session:spring-session-core")</div><div>&nbsp; &nbsp; implementation ("org.mapstruct:mapstruct:1.5.5.Final")</div><div>&nbsp; &nbsp; annotationProcessor ("org.mapstruct:mapstruct-processor:1.5.5.Final")</div><div>&nbsp; &nbsp; implementation("org.springframework.boot:spring-boot-devtools")</div><div>&nbsp; &nbsp; // runtimeOnly("com.h2database:h2")</div><div>&nbsp; &nbsp; testImplementation("org.springframework.boot:spring-boot-starter-test")</div><div>&nbsp; &nbsp; testImplementation("io.projectreactor:reactor-test")</div><div>&nbsp; &nbsp; testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc")</div><div>&nbsp; &nbsp; testAnnotationProcessor("org.mapstruct:mapstruct-processor:1.5.5.Final")</div><div>}</div><div><br></div><div>spotless {</div><div>&nbsp; java {</div><div>&nbsp; &nbsp; target("src/**/*.java")</div><div>&nbsp; &nbsp; googleJavaFormat()</div><div>&nbsp; &nbsp; removeUnusedImports()</div><div>&nbsp; }</div><div>}</div><div><br></div><div>asciidoctorj {</div><div>&nbsp; &nbsp; fatalWarnings(listOf(missingIncludes()))</div><div>}</div><div><br></div><div>tasks.withType<JavaCompile>().configureEach{</div><div>&nbsp; &nbsp; options.encoding = "UTF-8"</div><div>}</div><div><br></div><div>tasks.withType<Javadoc>().configureEach{</div><div>&nbsp; &nbsp; options.encoding = "UTF-8"</div><div>}</div><div><br></div><div>tasks.test {</div><div>&nbsp; &nbsp; systemProperty("file.encoding", "UTF-8")</div><div>&nbsp; &nbsp; useJUnitPlatform()</div><div>&nbsp; &nbsp; outputs.dir(snippetsDir)</div><div>}</div><div><br></div><div>tasks.asciidoctor {</div><div>&nbsp; &nbsp; inputs.dir(snippetsDir)</div><div>&nbsp; &nbsp; configurations(listOf(asciidoctorExt))</div><div>&nbsp; &nbsp; dependsOn("test")</div><div>&nbsp; &nbsp; attributes(mapOf("snippets" to snippetsDir))</div><div>&nbsp; &nbsp; outputOptions{</div><div>&nbsp; &nbsp; &nbsp; &nbsp; backends ("html5")</div><div>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; options(mapOf("doctype" to "book"))</div><div>}</div><div><br></div><div>tasks.jar {</div><div>&nbsp; &nbsp; dependsOn("asciidoctor")</div><div>&nbsp; &nbsp; from ("${snippetsDir}/html5") {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; into ("static/docs")</div><div>&nbsp; &nbsp; }</div><div>}</div><div><br></div><div>// A custom task to delete all the files and folders generated by Gradle</div><div>tasks.register<Delete>("clearAll") {</div><div>&nbsp; &nbsp; delete("bin")</div><div>&nbsp; &nbsp; delete (".classpath")</div><div>&nbsp; &nbsp; delete (".gradle")</div><div>&nbsp; &nbsp; delete (".nb-gradle")</div><div>&nbsp; &nbsp; delete (".project")</div><div>&nbsp; &nbsp; delete (".settings")</div><div>&nbsp; &nbsp; // delete (".vscode")</div><div>&nbsp; &nbsp; delete (".DS_Store")</div><div>&nbsp; &nbsp; delete (".idea")</div><div>&nbsp; &nbsp; dependsOn(tasks.clean)</div><div>}</div><div><br></div><div>```</div>

What did you expect to see?
I expected `gradle bootRun` to work as before (just well!). 

What did you see instead? And what is your understanding of the situation:
I understand my connector and core versions are not compatible. But the doc says it's ok for 8.0 I that's what i have. So what version should I use and above all, where/how do I find this info ? I really looked into your doc, nothing (same for the buildscript by the way.) I also looked into maven central i haven't find anything about compatibility. I would very much appreciate your answer so I would know for the futur.
error message :
<div>```</div><div>Application run failed</div><div><br></div><div>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Unsupported Database: MySQL 8.0</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1786) ~[spring-beans-6.1.6.jar:6.1.6]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600) ~[spring-beans-6.1.6.jar:6.1.6]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.6.jar:6.1.6]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.1.6.jar:6.1.6]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.6.jar:6.1.6]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.1.6.jar:6.1.6]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.6.jar:6.1.6]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:313) ~[spring-beans-6.1.6.jar:6.1.6]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.6.jar:6.1.6]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1234) ~[spring-context-6.1.6.jar:6.1.6]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:952) ~[spring-context-6.1.6.jar:6.1.6]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) ~[spring-context-6.1.6.jar:6.1.6]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.5.jar:3.2.5]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.2.5.jar:3.2.5]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.2.5.jar:3.2.5]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.boot.SpringApplication.run(SpringApplication.java:334) ~[spring-boot-3.2.5.jar:3.2.5]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-3.2.5.jar:3.2.5]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-3.2.5.jar:3.2.5]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at com.vf.eventhubserver.EventhubServerApplication.main(EventhubServerApplication.java:11) ~[main/:na]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50) ~[spring-boot-devtools-3.2.5.jar:3.2.5]</div><div>Caused by: org.flywaydb.core.api.FlywayException: Unsupported Database: MySQL 8.0</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.flywaydb.core.internal.database.DatabaseTypeRegister.lambda$getDatabaseTypeForConnection$7(DatabaseTypeRegister.java:122) ~[flyway-core-10.11.1.jar:na]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at java.base/java.util.Optional.orElseThrow(Optional.java:403) ~[na:na]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.flywaydb.core.internal.database.DatabaseTypeRegister.getDatabaseTypeForConnection(DatabaseTypeRegister.java:122) ~[flyway-core-10.11.1.jar:na]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.flywaydb.core.internal.jdbc.JdbcConnectionFactory.<init>(JdbcConnectionFactory.java:77) ~[flyway-core-10.11.1.jar:na]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:138) ~[flyway-core-10.11.1.jar:na]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.flywaydb.core.Flyway.migrate(Flyway.java:151) ~[flyway-core-10.11.1.jar:na]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:66) ~[spring-boot-autoconfigure-3.2.5.jar:3.2.5]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1833) ~[spring-beans-6.1.6.jar:6.1.6]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) ~[spring-beans-6.1.6.jar:6.1.6]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; ... 23 common frames omitted</div><div>```</div>


I would gladly provide anything relevant or the build 
Tagged:

Answers

  • Hello vifeng  welcome!

    I've tweaked your output to be a little easier to read.

    Config
    plugins {
    id("java")
    id("org.springframework.boot") version "3.2.5"
    id("io.spring.dependency-management") version "1.1.4"
    id("org.asciidoctor.jvm.convert") version "3.3.2"
    id("com.diffplug.spotless") version "6.25.0"
    id("org.flywaydb.flyway") version "10.11.1"
    }
    dependencyManagement {
    imports {
    mavenBom(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
    }
    }
    group = "com.vf"
    version = "0.0.1-SNAPSHOT"
    java {
    sourceCompatibility = JavaVersion.VERSION_17
    }
    springBoot {
    mainClass.set("com.vf.eventhubserver.EventhubServerApplication")
    }
    configurations {
    compileOnly {
    extendsFrom(configurations.annotationProcessor.get())
    }
    }
    repositories {
    mavenCentral()
    maven {
    url = uri("https://download.red-gate.com/maven/release")
    }
    }
    buildscript {
    repositories {
    mavenCentral()
    }
    dependencies {
    classpath("org.flywaydb:flyway-mysql:10.11.1")
    }
    }
    val snippetsDir by extra { file("build/generated-snippets") }
    val asciidoctorExt by configurations.creating
    dependencies {
    implementation(platform("com.google.cloud:spring-cloud-gcp-dependencies:4.1.4"))
    implementation("com.google.cloud:spring-cloud-gcp-starter-sql-mysql")
    implementation("com.google.cloud:google-cloud-secretmanager")
    implementation ("mysql:mysql-connector-java:8.0.31")
    implementation("org.flywaydb:flyway-core:10.11.1")
    implementation ("com.google.code.findbugs:jsr305:3.0.2")
    implementation("org.springframework.data:spring-data-rest-hal-explorer")
    asciidoctorExt("org.springframework.restdocs:spring-restdocs-asciidoctor")
    implementation("org.springframework.boot:spring-boot-starter-actuator")
    implementation("org.springframework.boot:spring-boot-starter-data-jpa")
    implementation("org.springframework.boot:spring-boot-starter-validation")
    implementation("org.springframework.boot:spring-boot-starter-web")
    implementation("org.springframework.boot:spring-boot-starter-webflux")
    implementation("org.springframework.session:spring-session-core")
    implementation ("org.mapstruct:mapstruct:1.5.5.Final")
    annotationProcessor ("org.mapstruct:mapstruct-processor:1.5.5.Final")
    implementation("org.springframework.boot:spring-boot-devtools")
    // runtimeOnly("com.h2database:h2")
    testImplementation("org.springframework.boot:spring-boot-starter-test")
    testImplementation("io.projectreactor:reactor-test")
    testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc")
    testAnnotationProcessor("org.mapstruct:mapstruct-processor:1.5.5.Final")
    }
    spotless {
    java {
    target("src/**/*.java")
    googleJavaFormat()
    removeUnusedImports()
    }
    }
    asciidoctorj {
    fatalWarnings(listOf(missingIncludes()))
    }
    tasks.withType().configureEach{
    options.encoding = "UTF-8"
    }
    tasks.withType().configureEach{
    options.encoding = "UTF-8"
    }
    tasks.test {
    systemProperty("file.encoding", "UTF-8")
    useJUnitPlatform()
    outputs.dir(snippetsDir)
    }
    tasks.asciidoctor {
    inputs.dir(snippetsDir)
    configurations(listOf(asciidoctorExt))
    dependsOn("test")
    attributes(mapOf("snippets" to snippetsDir))
    outputOptions{
    backends ("html5")
    }
    options(mapOf("doctype" to "book"))
    }
    tasks.jar {
    dependsOn("asciidoctor")
    from ("${snippetsDir}/html5") {
    into ("static/docs")
    }
    }
    // A custom task to delete all the files and folders generated by Gradle
    tasks.register("clearAll") {
    delete("bin")
    delete (".classpath")
    delete (".gradle")
    delete (".nb-gradle")
    delete (".project")
    delete (".settings")
    // delete (".vscode")
    delete (".DS_Store")
    delete (".idea")
    dependsOn(tasks.clean)
    }

    Exception
    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]: Unsupported Database: MySQL 8.0
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1786) ~[spring-beans-6.1.6.jar:6.1.6]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600) ~[spring-beans-6.1.6.jar:6.1.6]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.6.jar:6.1.6]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.1.6.jar:6.1.6]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.6.jar:6.1.6]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.1.6.jar:6.1.6]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.6.jar:6.1.6]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:313) ~[spring-beans-6.1.6.jar:6.1.6]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.6.jar:6.1.6]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1234) ~[spring-context-6.1.6.jar:6.1.6]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:952) ~[spring-context-6.1.6.jar:6.1.6]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) ~[spring-context-6.1.6.jar:6.1.6]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.5.jar:3.2.5]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.2.5.jar:3.2.5]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.2.5.jar:3.2.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:334) ~[spring-boot-3.2.5.jar:3.2.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-3.2.5.jar:3.2.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-3.2.5.jar:3.2.5]
    at com.vf.eventhubserver.EventhubServerApplication.main(EventhubServerApplication.java:11) ~[main/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50) ~[spring-boot-devtools-3.2.5.jar:3.2.5]
    Caused by: org.flywaydb.core.api.FlywayException: Unsupported Database: MySQL 8.0
    at org.flywaydb.core.internal.database.DatabaseTypeRegister.lambda$getDatabaseTypeForConnection$7(DatabaseTypeRegister.java:122) ~[flyway-core-10.11.1.jar:na]
    at java.base/java.util.Optional.orElseThrow(Optional.java:403) ~[na:na]
    at org.flywaydb.core.internal.database.DatabaseTypeRegister.getDatabaseTypeForConnection(DatabaseTypeRegister.java:122) ~[flyway-core-10.11.1.jar:na]
    at org.flywaydb.core.internal.jdbc.JdbcConnectionFactory.(JdbcConnectionFactory.java:77) ~[flyway-core-10.11.1.jar:na]
    at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:138) ~[flyway-core-10.11.1.jar:na]
    at org.flywaydb.core.Flyway.migrate(Flyway.java:151) ~[flyway-core-10.11.1.jar:na]
    at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:66) ~[spring-boot-autoconfigure-3.2.5.jar:3.2.5]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1833) ~[spring-beans-6.1.6.jar:6.1.6]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) ~[spring-beans-6.1.6.jar:6.1.6]
    ... 23 common frames omitted

    The first thing I don't see that I was expecting is there's no flyway MySQL implementation in your build script, I'm anticipating seeing
    dependencies {
        implementation "com.redgate.flyway:flyway-mysql"
    }
    (source).
    Kind regards
    Peter Laws | Redgate Software
    Have you visited our Help Center?
  • vifengvifeng Posts: 6 New member
    Hi petter, just saw your comment ! Yes i do have it in the buildscript 
    buildscript {
    repositories {
    mavenCentral()
    }
    dependencies {
    classpath("org.flywaydb:flyway-mysql:10.11.1")
    }
    the reason it's here was a no database error which i speaked about and that i read about here : https://github.com/flyway/flyway/issues/3722 and https://github.com/flyway/flyway/issues/3355
  • Please excuse me, I searched for the enterprise artifact in the output and I've just realised you're using the community edition.

    When you say initially that you're using Flyway Community 8.2.1 & Flyway OSS Edition 10.11.1 by Redgate in command line, do you mean you've tried both with similar effects?

    I'm a little dubious aboutv8 working with all the other newer tech as an asside.
    Kind regards
    Peter Laws | Redgate Software
    Have you visited our Help Center?
  • vifengvifeng Posts: 6 New member
    Yes Peter same effect for both Flyway Community 8.2.1 & Flyway OSS Edition 10.11.1 by Redgate.
    Do you have any recommandation I should try or should I report it as a bug?
  • vifengvifeng Posts: 6 New member
  • Hi - could you try changing the classpath("org.flywaydb:flyway-mysql:10.11.1") to implementation("org.flywaydb:flyway-mysql:10.11.1") please?
  • vifengvifeng Posts: 6 New member
    thank you for your answer. unfortunately, nope.. it didn't work..
    here is the code I tried per asked : 
    ```
    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            // delete classpath("org.flywaydb:flyway-mysql:10.11.1")
        classpath ("mysql:mysql-connector-java:8.0.31")
        }
    }

    val snippetsDir by extra { file("build/generated-snippets") }
    val asciidoctorExt by configurations.creating

    dependencies {
        implementation(platform("com.google.cloud:spring-cloud-gcp-dependencies:4.1.4"))
        implementation("com.google.cloud:spring-cloud-gcp-starter-sql-mysql")
        implementation("com.google.cloud:google-cloud-secretmanager")

        implementation("org.flywaydb:flyway-mysql:10.11.1")
        implementation("org.flywaydb:flyway-core:10.11.1")
    ```
  • Hi - in the original build script you had the mysql:mysql-connector-java:8.0.31 in implementation so I didn't mention it - your later one has moved it to classpath. I believe they all need to be implementation so they are available to the program at runtime
  • vifengvifeng Posts: 6 New member
    ok...  but if I do that

    buildscript {</code><code>
        repositories {
            mavenCentral()
        }
        dependencies {
            // classpath("org.flywaydb:flyway-mysql:10.11.1")
        	// classpath ("mysql:mysql-connector-java:8.0.31")
        }
    }
    
    val snippetsDir by extra { file("build/generated-snippets") }
    val asciidoctorExt by configurations.creating
    
    
    dependencies {
        implementation(platform("com.google.cloud:spring-cloud-gcp-dependencies:4.1.4"))
    	implementation("com.google.cloud:spring-cloud-gcp-starter-sql-mysql")
      	implementation("com.google.cloud:google-cloud-secretmanager")
    
    	implementation("mysql:mysql-connector-java:8.0.31")
    	implementation("org.flywaydb:flyway-mysql:10.11.1")
    	implementation("org.flywaydb:flyway-core:10.11.1")



    With a do `flyway clean` I have the no database error again as such
    <div>* What went wrong:</div><div>Execution failed for task ':flywayClean'.</div><div>> Error occurred while executing flywayClean</div><div>&nbsp; No database found to handle&nbsp;</div>
    if I do
    gradle bootRun 
    now I have this trace : (it's just the end) 

    2024-04-29T17:18:04.979+02:00 ERROR 18732 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed
    
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exceptio
    n is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [booking]
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1786) ~[spring-beans-6.1.6.jar:6.1.6]
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600) ~[spring-beans-6.1.6.jar:6.1.6]
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.6.jar:6.1.6]
            at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.1.6.jar:6.1.6]
            at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.6.jar:6.1.6]
            at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.1.6.jar:6.1.6]
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.6.jar:6.1.6]
            at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1234) ~[spring-context-6.1.6.jar:6.1.6]
            at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:952) ~[spring-context-6.1.6.jar:6.1.6]
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) ~[spring-context-6.1.6.jar:6.1.6]
            at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.5.jar:3.2.5]
            at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.2.5.jar:3.2.5]
            at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.2.5.jar:3.2.5]
            at org.springframework.boot.SpringApplication.run(SpringApplication.java:334) ~[spring-boot-3.2.5.jar:3.2.5]
            at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-3.2.5.jar:3.2.5]
            at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-3.2.5.jar:3.2.5]
            at com.vf.eventhubserver.EventhubServerApplication.main(EventhubServerApplication.java:11) ~[main/:na]
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
            at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
            at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
            at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50) ~[spring-boot-devtools-3.2.5.jar:3.2.5]
    Caused by: jakarta.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [booking]
            at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:421) ~[spring-orm-6.1.6.jar:6.1.6]
            at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-6.1.6.jar:6.1.6]
            at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:366) ~[spring-orm-6.1.6.jar:6.1.6]
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1833) ~[spring-beans-6.1.6.jar:6.1.6]
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) ~[spring-beans-6.1.6.jar:6.1.6]
            ... 21 common frames omitted
    Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [booking]
            at org.hibernate.tool.schema.internal.AbstractSchemaValidator.validateTable(AbstractSchemaValidator.java:134) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
            at org.hibernate.tool.schema.internal.GroupedSchemaValidatorImpl.validateTables(GroupedSchemaValidatorImpl.java:46) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
            at org.hibernate.tool.schema.internal.AbstractSchemaValidator.performValidation(AbstractSchemaValidator.java:97) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
            at org.hibernate.tool.schema.internal.AbstractSchemaValidator.doValidation(AbstractSchemaValidator.java:75) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
            at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:295) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
            at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.lambda$process$5(SchemaManagementToolCoordinator.java:145) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
            at java.base/java.util.HashMap.forEach(HashMap.java:1421) ~[na:na]
            at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:142) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
            at org.hibernate.boot.internal.SessionFactoryObserverForSchemaExport.sessionFactoryCreated(SessionFactoryObserverForSchemaExport.java:37) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
            at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
            at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:315) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
            at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:450) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
            at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1507) ~[hibernate-core-6.4.4.Final.jar:6.4.4.Final]
            at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:75) ~[spring-orm-6.1.6.jar:6.1.6]
            at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:390) ~[spring-orm-6.1.6.jar:6.1.6]
            at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-6.1.6.jar:6.1.6]
            ... 25 common frames omitted


Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file