Skip to content

spring-hibernate-mysql change log generation fails with "ldt" is null exception #748

Open
@swaroopar

Description

@swaroopar

Thank you for the great project. We need some help. While trying to generate change log using JPA entities as reference URL, the maven command fails with error. Please let me know if there is anything wrong with our setup.

versions

  • spring boot - 3.4.1
mvn  liquibase:diff -Dliquibase.verbose=true

[INFO] ERROR: Exception Details
[INFO] ERROR: Exception Primary Class:  NullPointerException
[INFO] ERROR: Exception Primary Reason:  Cannot invoke "liquibase.datatype.LiquibaseDataType.toDatabaseDataType(liquibase.database.Database)" because "ldt" is null
[INFO] ERROR: Exception Primary Source:  MySQL 9.1.0
[INFO] Command execution complete
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.184 s
[INFO] Finished at: 2025-01-22T06:04:40+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:4.31.0:diff (default-cli) on project xpanse-runtime: 
[ERROR] Error setting up or running Liquibase:
[ERROR] liquibase.exception.CommandExecutionException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke "liquibase.datatype.LiquibaseDataType.toDatabaseDataType(liquibase.database.Database)" because "ldt" is null
[ERROR] -> [Help 1]
<plugin>
              <groupId>org.liquibase</groupId>
              <artifactId>liquibase-maven-plugin</artifactId>
              <version>4.31.0</version>
              <configuration>
                  <propertyFile>liquibase.properties</propertyFile>
              </configuration>
              <dependencies>
                  <dependency>
                      <groupId>org.liquibase.ext</groupId>
                      <artifactId>liquibase-hibernate6</artifactId>
                      <version>4.31.0</version>
                  </dependency>
                  <dependency>
                      <groupId>org.liquibase</groupId>
                      <artifactId>liquibase-core</artifactId>
                      <version>4.31.0</version>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework.boot</groupId>
                      <artifactId>spring-boot-starter-validation</artifactId>
                      <version>${spring-boot.version}</version>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework.boot</groupId>
                      <artifactId>spring-boot-starter-jdbc</artifactId>
                      <version>${spring-boot.version}</version>
                  </dependency>
                  <dependency>
                      <groupId>org.springframework.boot</groupId>
                      <artifactId>spring-boot-starter-data-jpa</artifactId>
                      <version>${spring-boot.version}</version>
                  </dependency>
                  <dependency>
                      <groupId>org.eclipse.xpanse.modules</groupId>
                      <artifactId>database</artifactId>
                      <version>${project.version}</version>
                  </dependency>
              </dependencies>
          </plugin>

liquibase-properties

referenceUrl=hibernate:spring:org.eclipse.xpanse.modules.database.userpolicy?dialect=org.hibernate.dialect.MySQL8Dialect&hibernate.physical_naming_strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
referenceDriver=liquibase.ext.hibernate.database.connection.HibernateDriver
url=jdbc:mysql://localhost:3306/xpanse
username=xpanse
password=xpanse
driver=com.mysql.cj.jdbc.Driver
defaultSchemaName=xpanse
outputChangeLogFile=src/main/resources/liquibase-outputChangeLog.xml
changeLogFile=src/main/resources/liquibase-diff-changeLog.xml
diffChangeLogFile=src/main/resources/liquibase-diff-changeLog.xml

maven-output.log

Note - The same entity configuration works when we simply let hibernate auto create the DB objects in MySQL DB and then generate changelog using the DB directly as the reference URL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions