Flyway Enterprise 9.0.0 with MongoDB

Hello,

We are using Flyway Enterprise 9.0.0 with the Flyway Maven Plugin and trying to use it with MongoDB:

  • Flyway Enterprise Core (org.flywaydb.enterprise/flyway-core/9.0.0)
  • Flyway Maven Plugin (org.flywaydb.enterprise/flyway-maven-plugin/9.0.0)
  • MongoDB (org.flywaydb/flyway-database-mongodb/10.17.1).

Our project builds fine, but when executing a Flyway Migrate we see the error:

[ERROR] Failed to execute goal org.flywaydb.enterprise:flyway-maven-plugin:9.0.0:migrate (default-cli) on project rental20_flyway_mongodb_testing: Execution default-cli of goal org.flywaydb.enterprise:flyway-maven-plugin:9.0.0:migrate failed: An API incompatibility was encountered while executing org.flywaydb.enterprise:flyway-maven-plugin:9.0.0:migrate: java.lang.UnsupportedClassVersionError: org/flywaydb/database/mongodb/MongoDBDatabaseType has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Our build server is running Java 8.

Relevant POM entries:

    <properties>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      <flyway.version>9.0.0</flyway.version>
      <flyway.validateOnMigrate>false</flyway.validateOnMigrate>
      <flyway.sqlMigrationPrefix>R1V</flyway.sqlMigrationPrefix>
      <flyway.baselineOnMigrate>true</flyway.baselineOnMigrate>
      <flyway.outOfOrder>true</flyway.outOfOrder>
      <database.driver>com.dbschema.MongoJdbcDriver</database.driver>
      <database.schema>userdb</database.schema>
    </properties>

    <dependencies>
        <dependency>
          <groupId>org.flywaydb</groupId>
          <artifactId>flyway-database-mongodb</artifactId>
          <version>10.17.1</version>
        </dependency>
        <dependency>
          <groupId>org.flywaydb.enterprise</groupId>
          <artifactId>flyway-core</artifactId>
          <version>${flyway.version}</version>
        </dependency>
        <dependency>
          <groupId>org.flywaydb.enterprise</groupId>
          <artifactId>flyway-maven-plugin</artifactId>
          <version>${flyway.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
          <plugin>
            <groupId>org.flywaydb.enterprise</groupId>
            <artifactId>flyway-maven-plugin</artifactId>
            <version>${flyway.version}</version>
            <configuration>
              <driver>${database.driver}</driver>
              <schemas>
                <schema>${database.schema}</schema>
              </schemas>
            </configuration>
          </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>



Tagged:

Answers

  • Hi Erich,
     
    I’m sorry to hear about the issues you’re facing with Flyway. Based on the information you provided, it looks like the problem might be due to mismatched versions of Flyway dependencies:
    • Flyway Enterprise Core: 9.0.0 (org.flywaydb.enterprise/flyway-core/9.0.0)
    • Flyway Maven Plugin: 9.0.0 (org.flywaydb.enterprise/flyway-maven-plugin/9.0.0)
    • MongoDB: 10.17.1 (org.flywaydb/flyway-database-mongodb/10.17.1)
    It appears that while you’re using version 10.17.1 of the Flyway library for MongoDB, the other two dependencies are still on version 9. Since you mentioned that you have Java 8 installed, it’s important to note that Flyway versions 10 and above have deprecated Java 8 and now require Java 17. 
     
     Best,

    Hassan
    Product Support Engineer

Leave a Comment

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