executeCommand changeSet fails on >=3.10.1
See original GitHub issueEnvironment
Liquibase Version: >=3.10.1
Liquibase Integration & Version: ant
Liquibase Extension(s) & Version:
Database Vendor & Version: MariaDB 10.3
Operating System Type & Version: Debian Stretch
Description
A changeSet with only a <executeCommand>
statement fails in >=3.10.1, it works under 3.10.0.
Unable to update database. liquibase.exception.MigrationFailedException: Migration failed for change set liquibase.xml::xxxx::xxxx:
Reason: java.lang.ClassCastException: liquibase.database.jvm.JdbcConnection cannot be cast to com.datical.liquibase.ext.database.jvm.ProJdbcConnection
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:659)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:53)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:97)
at liquibase.Liquibase.update(Liquibase.java:201)
at liquibase.Liquibase.update(Liquibase.java:178)
at liquibase.Liquibase.update(Liquibase.java:328)
at liquibase.integration.ant.DatabaseUpdateTask.executeWithLiquibaseClassloader(DatabaseUpdateTask.java:34)
at liquibase.integration.ant.BaseLiquibaseTask.execute(BaseLiquibaseTask.java:88)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.Main.runBuild(Main.java:857)
at org.apache.tools.ant.Main.startAnt(Main.java:236)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:287)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:113)
Caused by: java.lang.ClassCastException: liquibase.database.jvm.JdbcConnection cannot be cast to com.datical.liquibase.ext.database.jvm.ProJdbcConnection
at com.datical.liquibase.ext.SqlPlusRunner.buildConnectionString(Unknown Source)
at com.datical.liquibase.ext.SqlPlusRunner.createFinalCommandArray(Unknown Source)
at liquibase.change.core.ExecuteShellCommandChange.generateStatements(ExecuteShellCommandChange.java:142)
at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1256)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:622)
... 36 more
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (8 by maintainers)
Top Results From Across the Web
executeCommand doesn't catch errors when using properties
I am trying to use executeCommand with OS specific scripts. A command might be something like: <changeSet author="ctrezza" id="theid"> ...
Read more >liquibase/changelog.txt at master - GitHub
- When set to `true` will attempt to rollback a failed update operation. - Note: changesets marked `failonerror=false`, do not count as error,...
Read more >changelog.txt · xiaowu/liquibase-3.10.2 - Gitee.com
- Fixed an 'Unexpected type: java.util.Date' error when using a defaultValueDate attribute in a YAML changelog. Changes in version 3.8.3 (2019.12.19).
Read more >Resolve change set errors in CloudFormation - Amazon AWS
I receive an error when I try to import resources into an AWS CloudFormation stack. Short description. Based on the type of error...
Read more >Release 3.10 Caveats - Cisco Content Hub
NTP leap second failure to insert after leap second occurs ... Conditions: Seen on ASR1002X running CCO IOS-XE version 3.10.1 The Crash has...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m not sure but I might I’m on to something. I spent some more time investigating last night and I do see a discrepancy on how the Ant tasks create the
DatabaseConnection
and how other integrations do (like the CLI).The Ant tasks create the
JdbcConnection
manually via theDatabaseFactory.findCorrectDatabaseImplementation()
method passing an already createdJdbcConnection
object. In other integrations, theDatabaseFactory.openDatabase()
method is called which creates the connection object itself. There is much more sophisticated logic around selecting the proper connection type in thisDatabaseFactory
(via theConnectionServiceFactory
). This may explain why the Ant tasks are unaware of the pro connection types.I am going to dig a little more and see if this affects the exception. I will hopefully have more information soon. Regardless of whether this fixes the problem, that is definitely something to change.
@molivasdat tried that example and it works fine with 3.9.0 but gets the same cast exception on 3.10.2 like before.
@mattbertolini doesn’t seem like a race condition to me seeing as I could reproduce it without fail again with @molivasdat example? Though it sounds like your PR there should fix it I guess. Don’t think I have time to test it though (well compile it and all that jazz that is).