Execute Changelogs. Reason: java.lang.ClassCastException: java.time.LocalDateTime cannot be cast to java.util.Date

Liquibase changelogs are failing deployment with the following error:

Execute Changelogs. Reason: java.lang.ClassCastException: java.time.LocalDateTime cannot be cast to java.util.Date

And our app is set up using Liquibase 4.3.3, Spring Boot 2.3.12, Java 1.8, and ‘mysql-connector-java’ 5.1.47.

I am not sure what’s causing this issue, I think liquibase is trying to update the ‘DATEEXECUTED’ column in the ‘databasechangelog’ table as it’s trying to execute the first change log file and the JDBC connection is now doing this datetime casting automatically (not sure if it happened behind the scenes when using the previous version of Liquibase to deploy the same change logs previously) but it’s happening now for some reason when Liquibase is started up.

Any guidance on this issue would be greatly appreciated.

Thanks.

This has historically been caused by a versioning issue between Liquibase and MySQL. We recommend updating to the latest version, which can be found on our docs site below.

Reference: