Bug Report

When creating a new Spring Boot 3.2.1 project with Liquidbase 4.23.0 and GraalVM Native Build 0.9.28 I get the following error when trying to do nativeRun. I made sure that the metadataRepository was enabled in the build.gradle and confirmed the versions I am using are supported. Liquibase is attempting to run 2 changelogs against a brand new Postgres instance. I have tried using changelogs in both SQL and YAML format yet the same error occurs.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase': liquibase.exception.LockException: liquibase.exception.UnexpectedLiquibaseException: java.lang.NoSuchMethodException: liquibase.changelog.ChangeLogHistoryServiceFactory.<init>()
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1773) ~[bookstore:6.1.2]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599) ~[bookstore:6.1.2]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[bookstore:6.1.2]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[bookstore:6.1.2]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[bookstore:6.1.2]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[bookstore:6.1.2]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[bookstore:6.1.2]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:312) ~[bookstore:6.1.2]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[bookstore:6.1.2]
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1232) ~[bookstore:6.1.2]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:950) ~[bookstore:6.1.2]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:625) ~[bookstore:6.1.2]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[bookstore:3.2.1]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) ~[bookstore:3.2.1]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:464) ~[bookstore:3.2.1]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:334) ~[bookstore:3.2.1]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1358) ~[bookstore:3.2.1]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1347) ~[bookstore:3.2.1]
        at com.thrailkill.bookstore.BookstoreApplication.main(BookstoreApplication.java:10) ~[bookstore:na]
        at java.base@21.0.1/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH) ~[na:na]
Caused by: liquibase.exception.CommandExecutionException: liquibase.exception.LockException: liquibase.exception.UnexpectedLiquibaseException: java.lang.NoSuchMethodException: liquibase.changelog.ChangeLogHistoryServiceFactory.<init>()
        at liquibase.command.CommandScope.execute(CommandScope.java:236) ~[bookstore:na]
        at liquibase.Liquibase.lambda$update$0(Liquibase.java:223) ~[bookstore:na]
        at liquibase.Scope.lambda$child$0(Scope.java:197) ~[bookstore:na]
        at liquibase.Scope.child(Scope.java:206) ~[bookstore:na]
        at liquibase.Scope.child(Scope.java:196) ~[bookstore:na]
        at liquibase.Scope.child(Scope.java:175) ~[bookstore:na]
        at liquibase.Liquibase.runInScope(Liquibase.java:1361) ~[bookstore:na]
        at liquibase.Liquibase.update(Liquibase.java:215) ~[bookstore:na]
        at liquibase.Liquibase.update(Liquibase.java:197) ~[bookstore:na]
        at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:329) ~[bookstore:na]
        at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:284) ~[bookstore:na]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1820) ~[bookstore:6.1.2]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1769) ~[bookstore:6.1.2]
        ... 19 common frames omitted
Caused by: liquibase.exception.LockException: liquibase.exception.UnexpectedLiquibaseException: java.lang.NoSuchMethodException: liquibase.changelog.ChangeLogHistoryServiceFactory.<init>()
        at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:341) ~[bookstore:na]
        at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:258) ~[bookstore:na]
        at liquibase.command.core.helpers.LockServiceCommandStep.run(LockServiceCommandStep.java:37) ~[bookstore:na]
        at liquibase.command.CommandScope.execute(CommandScope.java:213) ~[bookstore:na]
        ... 31 common frames omitted
Caused by: liquibase.exception.UnexpectedLiquibaseException: java.lang.NoSuchMethodException: liquibase.changelog.ChangeLogHistoryServiceFactory.<init>()
        at liquibase.Scope.getSingleton(Scope.java:349) ~[bookstore:na]
        at liquibase.Scope.getSingleton(Scope.java:332) ~[bookstore:na]
        at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:336) ~[bookstore:na]
        ... 34 common frames omitted
Caused by: java.lang.NoSuchMethodException: liquibase.changelog.ChangeLogHistoryServiceFactory.<init>()
        at java.base@21.0.1/java.lang.Class.checkMethod(DynamicHub.java:1065) ~[bookstore:na]
        at java.base@21.0.1/java.lang.Class.getConstructor0(DynamicHub.java:1228) ~[bookstore:na]
        at java.base@21.0.1/java.lang.Class.getDeclaredConstructor(DynamicHub.java:2930) ~[bookstore:na]
        at liquibase.Scope.getSingleton(Scope.java:344) ~[bookstore:na]
        ... 36 common frames omitted

How to reproduce:

  1. Go to https://start.spring.io/, choose version 3.2.1, Liquibase, JPA and H2 and create the app
  2. Add a single changelog or multiple to include multiple changelogs in the folder below it: Single Example:
databaseChangeLog:
  - changeSet:
      id:  1
      author: Liquibase User
      changes:
      - createTable:
          tableName: book
          columns:
          - column:
              name: isbn
              type: NUMERIC
              constraints:
                primaryKey: true
                nullable: false
          - column:
              name:  price
              type:  numeric(12)
              constraints:
                nullable:  false
  - changeSet:
      id:  2
      author: Liquibase User
      changes:
      - modifyDataType:
          tableName:  book
          columnName:  price
          newDataType:  numeric(12,2)

Multiple Example:

databaseChangeLog:
  - includeAll:
      path: /db/changelog/sql
  1. If you do multiple, add the following as well Example file db/changelog/sql/01-test.sql:
CREATE TABLE book
(
    isbn                NUMERIC PRIMARY KEY,
    price               NUMERIC(12) NOT NULL
)

Example file db/changelog/sql/02-alter.sql:

alter table book alter column price TYPE NUMERIC(12,2);
  1. Run nativeCompile (testing was done in Gradle)
  2. Run the resulting application and the error will show

Comment From: snicoll

For future reference, it is way easier for everyone to share the actual application rather than pasting each file here. To reproduce the issue we will have to copy and paste these ourselves and that's really a waste of time for everybody.

Spring Boot does not call ChangeLogHistoryServiceFactory and such missing hint should be reported to https://github.com/oracle/graalvm-reachability-metadata. I've done that https://github.com/oracle/graalvm-reachability-metadata/issues/431.

In the meantime you should be able to workaround the problem by adding the missing hint, see the repro project.