graalvm-reachability-metadata icon indicating copy to clipboard operation
graalvm-reachability-metadata copied to clipboard

Add support for `org.liquibase:liquibase-core:4.24.0`

Open snicoll opened this issue 2 years ago • 9 comments

Liquibase 4.24.0 requires an additional hint due to the use of ChangeLogHistoryServiceFactory that is created via reflection.

This has been reported in the Spring Boot project: https://github.com/spring-projects/spring-boot/issues/38941

Here is a sample that reproduces the issue if you comment @ImportRuntimeHints in the main application: https://github.com/snicoll-scratches/sb-38941

The missing reflect-config.json entry is as follows:

{
  "name": "liquibase.changelog.ChangeLogHistoryServiceFactory",
  "methods": [
    {
      "name": "<init>",
      "parameterTypes": [ ]
    }
  ]
}

snicoll avatar Dec 29 '23 07:12 snicoll

Also the liquibase.ui.LoggerUIService needs to be added. I managed to get it to work with the following reflect-config.json

[
  {
    "name": "liquibase.ui.LoggerUIService",
    "condition": {
      "typeReachable": "liquibase.ui.LoggerUIService"
    },
    "methods": [
      {
        "name": "<init>",
        "parameterTypes": [
        ]
      }
    ]
  },
  {
    "name": "liquibase.changelog.ChangeLogHistoryServiceFactory",
    "condition": {
      "typeReachable": "liquibase.changelog.ChangeLogHistoryServiceFactory"
    },
    "methods": [
      {
        "name": "<init>",
        "parameterTypes": [
        ]
      }
    ]
  },
  {
    "name": "liquibase.changelog.StandardChangeLogHistoryService",
    "condition": {
      "typeReachable": "liquibase.changelog.ChangeLogHistoryServiceFactory"
    },
    "methods": [
      {
        "name": "<init>",
        "parameterTypes": [
        ]
      }
    ]
  }
]

bmihnea avatar Mar 15 '24 09:03 bmihnea

Hey @snicoll @bmihnea , thanks for this request. It would be very nice if you can provide a pull request that adds missing metadata for this library. Here is our guide, how to contribute to metadata repository. If you have any questions, please feel free to ask.

dnestoro avatar Mar 15 '24 09:03 dnestoro

I believe that this issue has been covered by PR #385 already. When I upgrade the native maven plugin to use version 0.10.1, then the metadata for liquibase 4.23.0 is used and our Liquibase tests are passing. Using 0.9.27 they are failing (you can see this in https://github.com/flowable/flowable-engine/actions/runs/8363935080/job/22898067207)

filiphr avatar Mar 20 '24 20:03 filiphr

#385 didn't cover LoggerUIService that @bmihnea mentions above. Without it, I see failures with Liquibase 4.26.0:

Caused by: liquibase.exception.UnexpectedLiquibaseException: java.lang.NoSuchMethodException: liquibase.ui.LoggerUIService.<init>()	
	at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:304) ~[liquibase:na]	
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1833) ~[liquibase:6.1.6-SNAPSHOT]	
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) ~[liquibase:6.1.6-SNAPSHOT]	
	... 17 common frames omitted	
Caused by: java.lang.NoSuchMethodException: liquibase.ui.LoggerUIService.<init>()	
	at [email protected]/java.lang.Class.getConstructor0(DynamicHub.java:3585) ~[liquibase:na]	
	at [email protected]/java.lang.Class.getDeclaredConstructor(DynamicHub.java:2754) ~[liquibase:na]	
	at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:287) ~[liquibase:na]	
	... 19 common frames omitted

Perhaps this issue could be repurposed to tackle 4.26.0?

wilkinsona avatar Mar 22 '24 08:03 wilkinsona

Good point @wilkinsona. Thanks for spotting that

filiphr avatar Mar 22 '24 11:03 filiphr

We also discovered that this is needed too:

{
  "name":"liquibase.parser.SqlParserFactory",
  "methods":[{"name":"<init>","parameterTypes":[] }, {"name":"<init>","parameterTypes":["liquibase.Scope"] }]
}

alvarosanchez avatar Apr 10 '24 11:04 alvarosanchez

Need to add one more entry for 4.2.8

{
    "name": "liquibase.changelog.visitor.ValidatingVisitorGeneratorFactory",
    "methods": [
      {
        "name": "<init>",
        "parameterTypes": [

        ]
      },
      {
        "name": "<init>",
        "parameterTypes": [
          "liquibase.Scope"
        ]
      }
    ]
  }

radovanradic avatar May 31 '24 06:05 radovanradic