diffChangeLog on MYSQL dbs is not working

Hi, Iam trying to perform a diffChangeLog across two of my test MySQL DBs. I run liquibase using docker and use a command something like this:

sudo docker run -v ~/liquibase:/liquibase/difflogs -v ~/liquibase/mysql-connector-java-8.0.23:/liquibase/classpath  -v ~/liquibase/changelogs:/liquibase/changelog liquibase/liquibase --liquibaseProLicenseKey="my_liquibase_pro_key"  --classpath='/liquibase/classpath/mysql-connector-java-8.0.23.jar' --changeLogFile='/liquibase/changelog/changelog_mysql.xml' --outputFile='/liquibase/difflogs/diff_mysql.txt' --driver=com.mysql.cj.jdbc.Driver --url="url:3306/test_case_5" --username='username' --password='pw'  --referenceUrl="ref_url:3306/test_case_5" --referenceUsername='ref_username' --referencePassword='ref_pw' --logLevel=DEBUG diffChangeLog

This gives me an error something like this:

[2021-04-24 17:50:51] SEVERE [liquibase.integration] Unexpected error running Liquibase: java.lang.RuntimeException: java.lang.RuntimeException: liquibase.exception.UnexpectedLiquibaseException: /liquibase/changelog/objects-1619286650839/trigger is not a directory
liquibase.exception.LiquibaseException: liquibase.command.CommandExecutionException: java.lang.RuntimeException: java.lang.RuntimeException: liquibase.exception.UnexpectedLiquibaseException: /liquibase/changelog/objects-1619286650839/trigger is not a directory
	at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:211)
	at liquibase.integration.commandline.Main.doMigration(Main.java:1487)
	at liquibase.integration.commandline.Main$1.lambda$run$0(Main.java:361)
	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.Scope.child(Scope.java:222)
	at liquibase.Scope.child(Scope.java:226)
	at liquibase.integration.commandline.Main$1.run(Main.java:360)
	at liquibase.integration.commandline.Main$1.run(Main.java:193)
	at liquibase.Scope.child(Scope.java:169)
	at liquibase.Scope.child(Scope.java:145)
	at liquibase.integration.commandline.Main.run(Main.java:193)
	at liquibase.integration.commandline.Main.main(Main.java:156)
Caused by: liquibase.command.CommandExecutionException: java.lang.RuntimeException: java.lang.RuntimeException: liquibase.exception.UnexpectedLiquibaseException: /liquibase/changelog/objects-1619286650839/trigger is not a directory
	at liquibase.command.AbstractCommand.execute(AbstractCommand.java:24)
	at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:209)
	... 14 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: liquibase.exception.UnexpectedLiquibaseException: /liquibase/changelog/objects-1619286650839/trigger is not a directory
	at liquibase.diff.output.changelog.DiffToChangeLog.print(DiffToChangeLog.java:203)
	at liquibase.diff.output.changelog.DiffToChangeLog.print(DiffToChangeLog.java:85)
	at liquibase.command.core.DiffToChangeLogCommand.run(DiffToChangeLogCommand.java:72)
	at liquibase.command.AbstractCommand.execute(AbstractCommand.java:19)
	... 15 more
Caused by: java.lang.RuntimeException: liquibase.exception.UnexpectedLiquibaseException: /liquibase/changelog/objects-1619286650839/trigger is not a directory
	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)
	... 18 more
Caused by: liquibase.exception.UnexpectedLiquibaseException: /liquibase/changelog/objects-1619286650839/trigger is not a directory
	at com.datical.liquibase.ext.util.ObjectSqlFileUtil.writeObjectSql(Unknown Source)
	at com.datical.liquibase.ext.util.ObjectSqlFileUtil.writeObjectSql(Unknown Source)
	at com.datical.liquibase.ext.storedlogic.trigger.MissingTriggerExternalFileChangeGenerator.fixMissing(Unknown Source)
	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.print(DiffToChangeLog.java:246)
	at liquibase.diff.output.changelog.DiffToChangeLog$1.run(DiffToChangeLog.java:137)
	... 23 more

Tried searching in the web, couldn’t find any instance of such issue. Can someone help me out here?

Best,
Viswak

--changeLogFile='/liquibase/changelog/changelog_mysql.xml'

Does this changelog file reference folders where changes are located? The caused by block indicates:

Caused by: liquibase.command.CommandExecutionException: java.lang.RuntimeException: java.lang.RuntimeException: liquibase.exception.UnexpectedLiquibaseException: /liquibase/changelog/objects-1619286650839/trigger is not a directory

Seems to indicate it can’t find this directory, is that being referenced in a changeset?

Hi Ronak,
Thank you for the response. The changelog_mysql.xml is an empty file. I tried executing this statement in my host machine without docker, and it worked. I think this issue was due to some permission issue running it in a docker container. This issue is now resolved.

Thank you once again.
Viswak

Liquibase docker image doesn’t have driver for MySQL. It is written in the official documentation.

Try to run docker run -e INSTALL_MYSQL=true liquibase/liquibase diffChangeLog instead.