skip to Main Content

We have a Spring boot Web application where spring boot version is 1.5.6. After upgrading the AWS MySQL RDS to 8.0.28 from 5.7.0 we are getting liquibase error. I have upgraded the MySQL connector dependency to version 8.0.34 and liquibase-core version to 3.7.0 in pom.xml.

<dependency>
    <groupId>org.liquibase</groupId>
    <artifactId>liquibase-core</artifactId>
    <version>3.7.0</version>
</dependency>
<dependency>
    <groupId>com.mysql</groupId>
    <artifactId>mysql-connector-j</artifactId>
    <version>8.0.34</version>
</dependency>

I have added changed the driver class name and hibernate dialect

spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect

I am getting error

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource
[org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is java.lang.ClassCastException: java.time.LocalDateTime cannot be cast to java.lang.String

When I use liquibase version greater than 4 I am getting another error
Exception in thread "main" java.lang.NoClassDefFoundError: liquibase/servicelocator/CustomResolverServiceLocator at org.springframework.boot.liquibase.LiquibaseServiceLocatorApplicationListener$LiquibasePresent.replaceServiceLocator(LiquibaseServiceLocatorApplicationListener.java:54) at org.springframework.boot.liquibase.LiquibaseServiceLocatorApplicationListener.onApplicationEvent(LiquibaseServiceLocatorApplicationListener.java:44)
Please help me to resolve that issue

2

Answers


  1. Chosen as BEST ANSWER

    I have resolved this issue by upgrading the MySQL version to 8.0.22 and Liquibase-core version to 3.10.0


  2. This issue often arises when Liquibase attempts to execute a change log containing a change set with a value attribute designed for a String type, but instead receives a LocalDateTime type.

    1-Inspect Change Log Files: Thoroughly review your Liquibase change log files to pinpoint any change sets involving casting or conversion to a String type. Pay close attention to attributes that anticipate a String but encounter a LocalDateTime or another incompatible type.
    2-Adjust Change Sets: Once you’ve identified the troublesome change sets, make the necessary adjustments to handle LocalDateTime or other types appropriately. This may entail modifying data types or implementing conversions within the change sets.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search