Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Add Liquibase support #620

Closed
derkoe opened this issue Mar 16, 2021 · 12 comments
Closed

Add Liquibase support #620

derkoe opened this issue Mar 16, 2021 · 12 comments
Labels
for: external-project For an external project and not something we can fix jvm-reachability-metadata Should be supported via the GraalVM JVM Reachability Metadata Repository once available type: compatibility Native image compatibility issue

Comments

@derkoe
Copy link

derkoe commented Mar 16, 2021

When running a Spring Boot app with Liquibase enabled the following error occurs:

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 liquibase.exception.UnexpectedLiquibaseException: Cannot create default configuration liquibase.configuration.GlobalConfiguration
...
Caused by: liquibase.exception.UnexpectedLiquibaseException: Cannot create default configuration liquibase.configuration.GlobalConfiguration
        at liquibase.configuration.LiquibaseConfiguration.createConfiguration(LiquibaseConfiguration.java:123) ~[na:na]
        at liquibase.configuration.LiquibaseConfiguration.getConfiguration(LiquibaseConfiguration.java:88) ~[na:na]
        at liquibase.configuration.LiquibaseConfiguration.getProperty(LiquibaseConfiguration.java:113) ~[na:na]
        at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:297) ~[com.example.liquibasedemo.liquibasedemoapplication:na]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1845) ~[na:na]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) ~[na:na]
        ... 19 common frames omitted
Caused by: java.lang.NoSuchMethodException: liquibase.configuration.GlobalConfiguration.<init>()
        at java.lang.Class.getConstructor0(DynamicHub.java:3349) ~[na:na]
        at java.lang.Class.getConstructor(DynamicHub.java:2151) ~[na:na]
        at liquibase.configuration.LiquibaseConfiguration.createConfiguration(LiquibaseConfiguration.java:119) ~[na:na]
        ... 24 common frames omitted

Seems like there are not hints implemented for Liquibase - see Quarkus implementation for inspiration

@derkoe
Copy link
Author

derkoe commented Mar 16, 2021

I have tried to adapt the Quarkus rules in this branch : LiquibaseHints.java

Then I run into this error:

Caused by: liquibase.exception.UnexpectedLiquibaseException: Cannot find LockService for unsupported
        at liquibase.lockservice.LockServiceFactory.getLockService(LockServiceFactory.java:74) ~[na:na]
        at liquibase.Liquibase.update(Liquibase.java:182) ~[na:na]
        at liquibase.Liquibase.update(Liquibase.java:178) ~[na:na]
        at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:368) ~[com.example.liquibasedemo.liquibasedemoapplication:na]
        at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:316) ~[com.example.liquibasedemo.liquibasedemoapplication:na]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1845) ~[na:na]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) ~[na:na]
        ... 19 common frames omitted

@sdeleuze sdeleuze added this to the 0.10.0 milestone Mar 16, 2021
@sdeleuze sdeleuze added the type: compatibility Native image compatibility issue label Mar 16, 2021
@derkoe
Copy link
Author

derkoe commented Apr 6, 2021

There is already a PR in Liquibase that will fix this for 4.x (which will be used in Spring Boot 2.5): liquibase/liquibase#1582

(tried that with Spring Boot 2.5.0-M3 and that works)

@sdeleuze
Copy link
Contributor

sdeleuze commented Apr 6, 2021

Nice so I close this issue.

@sdeleuze sdeleuze closed this as completed Apr 6, 2021
@sdeleuze sdeleuze removed this from the 0.10.0 milestone Apr 6, 2021
@sdeleuze sdeleuze added the status: declined A suggestion or change that we don't feel we should currently apply label Apr 6, 2021
@derkoe
Copy link
Author

derkoe commented Apr 6, 2021

@sdeleuze I thought more about taking the PR as an inspiration for a Spring Boot 2.4 backport.

I also think that Spring Native should add the Liquibase Changset files (like Quarkus does here https://github.com/quarkusio/quarkus/blob/3caaf4b4c66bd0ba11caa4fde528ed2854dace9b/extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/deployment/LiquibaseProcessor.java#L271)

@derkoe
Copy link
Author

derkoe commented Apr 8, 2021

The issue with Spring Boot 2.4 is the class org.springframework.boot.liquibase.SpringPackageScanClassResolver - this breaks the service discovery with native-image.

@sdeleuze
Copy link
Contributor

sdeleuze commented Apr 9, 2021

I prefer to wait for Spring Boot 2.5 and proper support, it will be released shortly.

@derkoe
Copy link
Author

derkoe commented Jul 29, 2021

Liquibase just closed the PR liquibase/liquibase#1582 - seems like Spring has to deal with it (like Quarkus and Micronaut do)

@sdeleuze
Copy link
Contributor

Ok let's reopen it for tracking purpose. I added a comment here I think the next step would be contributing a testing PR on Liquibase side.

Notice that there should be a native configuration repository in a few months for this kind of need, and that GraalVM 21.3 will changes a few rules regarding native configuration, so probably better to wait for it.

@sdeleuze sdeleuze reopened this Jul 29, 2021
@sdeleuze sdeleuze removed the status: declined A suggestion or change that we don't feel we should currently apply label Jul 29, 2021
@sdeleuze sdeleuze added this to the Backlog milestone Jul 29, 2021
@sdeleuze
Copy link
Contributor

sdeleuze commented Oct 1, 2021

See the configuration crafted in #1118.

@sdeleuze
Copy link
Contributor

sdeleuze commented Oct 1, 2021

See also my related comment on Liquibase side.

nkonev added a commit to nkonev/spring-native-liquibase-demo that referenced this issue Nov 27, 2021
@sdeleuze sdeleuze added the jvm-reachability-metadata Should be supported via the GraalVM JVM Reachability Metadata Repository once available label Mar 17, 2022
@crilofer
Copy link

Hi!

Any update on that?

@sdeleuze
Copy link
Contributor

sdeleuze commented Jan 2, 2023

Yes support has been added to https://github.com/oracle/graalvm-reachability-metadata. See below the generic closing comment with more information.

Spring Native is now superseded by Spring Boot 3 official native support, see the related reference documentation for more details.

As a consequence, I am closing this issue, and recommend trying your use case with latest Spring Boot 3 version. If you still experience the issue reported here, please open an issue directly on the GraalVM Reachability Repository project.

Thanks for your contribution on the experimental Spring Native project, we hope you will enjoy the official native support introduced by Spring Boot 3.

@sdeleuze sdeleuze closed this as completed Jan 2, 2023
@sdeleuze sdeleuze added the for: external-project For an external project and not something we can fix label Jan 2, 2023
@sdeleuze sdeleuze removed this from the Backlog milestone Jan 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
for: external-project For an external project and not something we can fix jvm-reachability-metadata Should be supported via the GraalVM JVM Reachability Metadata Repository once available type: compatibility Native image compatibility issue
Development

No branches or pull requests

3 participants