简体   繁体   中英

Error during testing for MySQL/MariaDB JDBC driver bug

I have been trying to integrate Liquibase 3.6.3 with spring boot 2.1.5.RELEASE application and I am getting this error when running the application.

Caused by: liquibase.exception.DatabaseException: liquibase.exception.UnexpectedLiquibaseException: Error during testing for MySQL/MariaDB JDBC driver bug: could not retrieve JDBC metadata information for temporary table 'TMP_TYIVMBAICPSUJGIJ'
at liquibase.snapshot.jvm.ForeignKeySnapshotGenerator.snapshotObject(ForeignKeySnapshotGenerator.java:223) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:66) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:49) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:69) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:49) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:286) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:407) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:334) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:309) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:407) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:429) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:334) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:309) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:386) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:334) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:309) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:102) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:59) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:38) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:217) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:246) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:230) ~[liquibase-core-3.6.3.jar:na]
at liquibase.change.core.LoadDataChange.retrieveMissingColumnLoadTypes(LoadDataChange.java:581) ~[liquibase-core-3.6.3.jar:na]
at liquibase.change.core.LoadDataChange.generateStatements(LoadDataChange.java:283) ~[liquibase-core-3.6.3.jar:na]
... 121 common frames omitted

Caused by: liquibase.exception.UnexpectedLiquibaseException: Error during testing for MySQL/MariaDB JDBC driver bug: could not retrieve JDBC metadata information for temporary table 'TMP_TYIVMBAICPSUJGIJ'
at liquibase.database.core.MySQLDatabase.hasBugJdbcConstraintsDeferrable(MySQLDatabase.java:275) ~[liquibase-core-3.6.3.jar:na]
at liquibase.snapshot.jvm.ForeignKeySnapshotGenerator.snapshotObject(ForeignKeySnapshotGenerator.java:188) ~[liquibase-core-3.6.3.jar:na]
... 144 common frames omitted

My Configuration is as follows;

    outputChangeLogFile=src/main/resources/config/db/db.changelog-master.xml
    driver = com.mysql.cj.jdbc.Driver
    url=jdbc:mysql://localhost:3306/<dbname>?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&useTimezone=true&serverTimezone=UTC
    username = <username>
    password = <password>

Also adding the master change log file

 <?xml version="1.1" encoding="UTF-8" standalone="no"?>
 <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">

<include file="classpath:config/db/changelog/db.changelog-1.0.xml" relativeToChangelogFile="false"/>
<include file="classpath:config/db/changelog/db.changelog-1.1.xml" relativeToChangelogFile="false"/>

I tried to change the version to 3.5.3 then spring is giving the error

***************************
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.liquibase.LiquibaseAutoConfiguration$LiquibaseConfiguration.liquibase(LiquibaseAutoConfiguration.java:127)

The following method did not exist:

liquibase.integration.spring.SpringLiquibase.setLiquibaseSchema(Ljava/lang/String;)V

The method's class, liquibase.integration.spring.SpringLiquibase, is available from the following locations:

jar:file:/C:/Users/<user>/.m2/repository/org/liquibase/liquibase-core/3.5.3/liquibase-core-3.5.3.jar!/liquibase/integration/spring/SpringLiquibase.class

It was loaded from the following location:

file:/C:/Users/<user>/.m2/repository/org/liquibase/liquibase-core/3.5.3/liquibase-core-3.5.3.jar


 Action:

 Correct the classpath of your application so that it contains a single, compatible version of liquibase.integration.spring.SpringLiquibase

Is this a bug? How can I resolve this issue?

NOTE : liquibase-maven-plugin:3.5.3:update using

mvn: liquibase:update

helped me generate the tables. I used

liquibase-maven-plugin:3.5.3

for generating it. Still do not know why 3.6.3 giving the error.

The problem may be that your MySQL instance runs with MyISAM as default storage engine.

In releases 3.6.x and 3.7.x, Liquibase tries to create a temporary table to check a jdbc driver bug. If it is created with MyISAM engine, the constraints of this table are then deferrable. Liquibase converts this into a "driver bug" error (their method is even named hasBugJdbcConstraintsDeferrable).

To solve the problem :

  • Set InnoDb as default storage engine to avoid the problem
  • Or downgrade liquibase to 3.5.x
  • Or upgrade Liquibase to future 4.0.x (not yet released).
  • The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

     
    粤ICP备18138465号  © 2020-2024 STACKOOM.COM