generateChangeLog fails with java.lang.IndexOutOfBoundsException

I was trying to evaluate LiquiBase, but I didnt get past generateChangeLog.

Running Java version “11.0.8” 2020-07-14 LTS
LiquiBase version 4.3.2
10.4.16-MariaDB
Driver mariadb-java-client-2.7.2.jar

liquibase.properties
driver: org.mariadb.jdbc.Driver
classpath: ./mariadb-java-client-2.7.2.jar
url: jdbc:mariadb://host:port/db
username: user
password: pwd
changeLogFile: myChangeLog.xml
liquibase.hub.ApiKey: xx
liquibaseProLicenseKey: xx

commandrun:
liquibase --logLevel=debug generateChangeLog

I have removed sequences and views , just in case.

Any suggestion where to start?

Stacktrace:
[2021-03-30 15:53:48] FIN [liquibase.servicelocator] Loaded liquibase.diff.output.changelog.ChangeGenerator instance com.datical.liquibase.ext.storedlogic.trigger.UnexpectedTriggerChangeGenerator
[2021-03-30 15:53:48] FIN [liquibase.diff] ChangedObjectChangeGenerator type order: liquibase.structure.core.Catalog liquibase.structure.core.ForeignKey liquibase.structure.core.Schema liquibase.structure.core.Sequence liquibase.structure.core.Table liquibase.structure.core.Column liquibase.structure.core.PrimaryKey liquibase.structure.core.UniqueConstraint liquibase.structure.core.Index liquibase.structure.core.View
[2021-03-30 15:53:48] FIN [liquibase.diff] MissingObjectChangeGenerator type order: liquibase.structure.core.Catalog liquibase.structure.core.Schema liquibase.structure.core.Sequence liquibase.structure.core.Table liquibase.structure.core.Column liquibase.structure.core.PrimaryKey liquibase.structure.core.UniqueConstraint liquibase.structure.core.Index liquibase.structure.core.ForeignKey liquibase.structure.core.View
Unexpected error running Liquibase: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
For more information, please use the --logLevel flag
[2021-03-30 15:53:48] ALLVARLIG [liquibase.integration] Unexpected error running Liquibase: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
liquibase.exception.LiquibaseException: liquibase.command.CommandExecutionException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog(CommandLineUtils.java:251)
at liquibase.integration.commandline.Main.doMigration(Main.java:1542)
at liquibase.integration.commandline.Main$1.lambda$run$0(Main.java:367)
at liquibase.Scope.lambda$child$0(Scope.java:160)
at liquibase.Scope.child(Scope.java:169)
at liquibase.Scope.child(Scope.java:159)
at liquibase.Scope.child(Scope.java:138)
at liquibase.integration.commandline.Main$1.run(Main.java:366)
at liquibase.integration.commandline.Main$1.run(Main.java:196)
at liquibase.Scope.child(Scope.java:169)
at liquibase.Scope.child(Scope.java:145)
at liquibase.integration.commandline.Main.run(Main.java:196)
at liquibase.integration.commandline.Main.main(Main.java:158)
Caused by: liquibase.command.CommandExecutionException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at liquibase.command.AbstractCommand.execute(AbstractCommand.java:24)
at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog(CommandLineUtils.java:249)
… 12 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at liquibase.diff.output.changelog.DiffToChangeLog.print(DiffToChangeLog.java:203)
at liquibase.diff.output.changelog.DiffToChangeLog.print(DiffToChangeLog.java:85)
at liquibase.command.core.GenerateChangeLogCommand.run(GenerateChangeLogCommand.java:74)
at liquibase.command.AbstractCommand.execute(AbstractCommand.java:19)
… 13 more
Caused by: java.lang.RuntimeException: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at liquibase.diff.output.changelog.DiffToChangeLog$1.run(DiffToChangeLog.java:186)
at liquibase.Scope.lambda$child$0(Scope.java:160)
at liquibase.Scope.child(Scope.java:169)
at liquibase.Scope.child(Scope.java:159)
at liquibase.Scope.child(Scope.java:138)
at liquibase.diff.output.changelog.DiffToChangeLog.print(DiffToChangeLog.java:127)
… 16 more
Caused by: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at java.base/jdk.internal.util.Preconditions.outOfBounds(Unknown Source)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Unknown Source)
at java.base/jdk.internal.util.Preconditions.checkIndex(Unknown Source)
at java.base/java.util.Objects.checkIndex(Unknown Source)
at java.base/java.util.ArrayList.get(Unknown Source)
at liquibase.change.ColumnConfig.(ColumnConfig.java:154)
at liquibase.change.AddColumnConfig.(AddColumnConfig.java:16)
at liquibase.diff.output.changelog.core.MissingIndexChangeGenerator.fixMissing(MissingIndexChangeGenerator.java:70)
at liquibase.diff.output.changelog.ChangeGeneratorChain.fixMissing(ChangeGeneratorChain.java:48)
at liquibase.diff.output.changelog.ChangeGeneratorFactory.fixMissing(ChangeGeneratorFactory.java:95)
at liquibase.diff.output.changelog.DiffToChangeLog.generateChangeSets(DiffToChangeLog.java:302)
at liquibase.diff.output.changelog.DiffToChangeLog.printNew(DiffToChangeLog.java:226)
at liquibase.diff.output.changelog.DiffToChangeLog$1.run(DiffToChangeLog.java:133)
… 21 more

Hi @MagnusHagstrom ,

Thanks for providing all that info. It was very helpful to see exact command ran and liquibase property values. May we take a look at the whole log and not only the stack trace? I noticed you had log level set to debug so it should provide more context.

Thanks,

Ronak

Sure thing, I didnt find any way to attach a file on this forum, I used a online service. The file is valid for 30 days

I put alot of time testing yesterday. I created a new database and took the script for creating our database to generate all the tables , views and sequences. I ran generateChangeLog and it failed.

I created a new database , this time I took the same script as above, but I created the tables,views and sequnces in the correct order ( ie SET FOREIGN_KEY_CHECKS=1; was on the whole time.) This time the generateChangeLog didnt fail.

Maybe this is some good information for you, it seems that LiquiBase has som difficulties figuring out the correct order of things.

It is some good news for me, I now have a workaround :

  1. Create the tables in the correct order in a tmp database.
  2. GenerateChangeLog
  3. Do a changeLogSync
  4. Transfer tables (DATABASECHANGELOG, DATABASECHANGELOGLOCK) to the correct destination database.