Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flyway 9.16.3 doesn't work with SLF4J loggers #281

Closed
mhalbritter opened this issue May 10, 2023 · 2 comments
Closed

Flyway 9.16.3 doesn't work with SLF4J loggers #281

mhalbritter opened this issue May 10, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@mhalbritter
Copy link
Collaborator

2023-04-23T10:53:26.257+02:00 ERROR 75122 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer': null
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1770) ~[kotlin-spring-data-rest-movies:6.0.8]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598) ~[kotlin-spring-data-rest-movies:6.0.8]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[kotlin-spring-data-rest-movies:6.0.8]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[kotlin-spring-data-rest-movies:6.0.8]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[kotlin-spring-data-rest-movies:6.0.8]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[kotlin-spring-data-rest-movies:6.0.8]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[kotlin-spring-data-rest-movies:6.0.8]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:313) ~[kotlin-spring-data-rest-movies:6.0.8]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[kotlin-spring-data-rest-movies:6.0.8]
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1132) ~[kotlin-spring-data-rest-movies:6.0.8]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:907) ~[kotlin-spring-data-rest-movies:6.0.8]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[kotlin-spring-data-rest-movies:6.0.8]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[kotlin-spring-data-rest-movies:3.1.0-RC1]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:733) ~[kotlin-spring-data-rest-movies:3.1.0-RC1]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:435) ~[kotlin-spring-data-rest-movies:3.1.0-RC1]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:311) ~[kotlin-spring-data-rest-movies:3.1.0-RC1]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1305) ~[kotlin-spring-data-rest-movies:3.1.0-RC1]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1294) ~[kotlin-spring-data-rest-movies:3.1.0-RC1]
        at tech.aaregall.lab.movies.AppKt.main(App.kt:13) ~[kotlin-spring-data-rest-movies:na]
Caused by: java.lang.ExceptionInInitializerError: null
        at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:61) ~[na:na]
        at org.flywaydb.core.internal.logging.log4j2.Log4j2LogCreator.createLogger(Log4j2LogCreator.java:24) ~[kotlin-spring-data-rest-movies:na]
        at org.flywaydb.core.internal.logging.multi.MultiLogCreator.createLogger(MultiLogCreator.java:34) ~[na:na]
        at org.flywaydb.core.api.logging.LogFactory.getLog(LogFactory.java:89) ~[na:na]
        at org.flywaydb.core.internal.license.VersionPrinter.<clinit>(VersionPrinter.java:27) ~[na:na]
        at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:121) ~[na:na]
        at org.flywaydb.core.Flyway.migrate(Flyway.java:140) ~[kotlin-spring-data-rest-movies:na]
        at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:66) ~[kotlin-spring-data-rest-movies:na]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1816) ~[kotlin-spring-data-rest-movies:6.0.8]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1766) ~[kotlin-spring-data-rest-movies:6.0.8]
        ... 18 common frames omitted
Caused by: java.lang.IllegalStateException: java.lang.InstantiationException: org.apache.logging.log4j.message.DefaultFlowMessageFactory
        at org.apache.logging.log4j.spi.AbstractLogger.createDefaultFlowMessageFactory(AbstractLogger.java:242) ~[kotlin-spring-data-rest-movies:2.20.0]
        at org.apache.logging.log4j.spi.AbstractLogger.<init>(AbstractLogger.java:141) ~[kotlin-spring-data-rest-movies:2.20.0]
        at org.apache.logging.log4j.status.StatusLogger.<init>(StatusLogger.java:141) ~[na:na]
        at org.apache.logging.log4j.status.StatusLogger.<clinit>(StatusLogger.java:91) ~[na:na]
        ... 28 common frames omitted
Caused by: java.lang.InstantiationException: org.apache.logging.log4j.message.DefaultFlowMessageFactory
        at java.base@17.0.5/java.lang.Class.newInstance(DynamicHub.java:639) ~[kotlin-spring-data-rest-movies:na]
        at org.apache.logging.log4j.spi.AbstractLogger.createDefaultFlowMessageFactory(AbstractLogger.java:240) ~[kotlin-spring-data-rest-movies:2.20.0]
        ... 31 common frames omitted
Caused by: java.lang.NoSuchMethodException: org.apache.logging.log4j.message.DefaultFlowMessageFactory.<init>()
        at java.base@17.0.5/java.lang.Class.getConstructor0(DynamicHub.java:3585) ~[kotlin-spring-data-rest-movies:na]
        at java.base@17.0.5/java.lang.Class.newInstance(DynamicHub.java:626) ~[kotlin-spring-data-rest-movies:na]
        ... 32 common frames omitted

It looks like that Flyway doesn't detect that SLF4J is available and falls back to Log4j, which is not native compatible.

@mhalbritter mhalbritter added the bug Something isn't working label May 10, 2023
@mhalbritter
Copy link
Collaborator Author

@mhalbritter
Copy link
Collaborator Author

NVM, seems to be a Flyway bug: flyway/flyway#3651

@mhalbritter mhalbritter closed this as not planned Won't fix, can't repro, duplicate, stale May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant