gravitee-io / issues

Gravitee.io - API Platform - Issues
64 stars 26 forks source link

[APIM] MySQL driver version 8.0.23 and later do not work with APIM #8751

Closed kirestoj01 closed 1 year ago

kirestoj01 commented 1 year ago

:collision: Describe the bug

MySQL drivers 8.0.23 or later do not work with APIM. When the environment starts we are getting the following errors:

10:22:04.119 [graviteeio-node] INFO  i.g.p.r.i.RepositoryPluginHandler - Repository [MANAGEMENT] loaded by jdbc
10:22:27.574 [graviteeio-node] WARN  o.s.c.a.AnnotationConfigApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcManagementRepositoryConfiguration': Initialization of bean failed; nested exception is io.gravitee.repository.jdbc.exception.DatabaseInitializationException: Failed to set up database
10:22:27.577 [graviteeio-node] ERROR i.g.p.c.i.PluginContextFactoryImpl - Unable to refresh plugin context
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcManagementRepositoryConfiguration': Initialization of bean failed; nested exception is io.gravitee.repository.jdbc.exception.DatabaseInitializationException: Failed to set up database
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:628)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
    at io.gravitee.plugin.core.internal.PluginContextFactoryImpl.create(PluginContextFactoryImpl.java:58)
    at io.gravitee.plugin.repository.internal.RepositoryPluginHandler.loadRepository(RepositoryPluginHandler.java:132)
    at io.gravitee.plugin.repository.internal.RepositoryPluginHandler.handle(RepositoryPluginHandler.java:105)
    at io.gravitee.plugin.core.internal.PluginEventListener.lambda$deployPlugin$8(PluginEventListener.java:140)
    at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
    at java.base/java.util.Iterator.forEachRemaining(Unknown Source)
    at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
    at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
    at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
    at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
    at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
    at java.base/java.util.stream.ReferencePipeline.forEach(Unknown Source)
    at io.gravitee.plugin.core.internal.PluginEventListener.deployPlugin(PluginEventListener.java:138)
    at io.gravitee.plugin.core.internal.PluginEventListener.lambda$deployPlugins$5(PluginEventListener.java:121)
    at java.base/java.util.ArrayList.forEach(Unknown Source)
    at io.gravitee.plugin.core.internal.PluginEventListener.deployPlugins(PluginEventListener.java:121)
    at io.gravitee.plugin.core.internal.PluginEventListener.onEvent(PluginEventListener.java:66)
    at io.gravitee.common.event.impl.EventManagerImpl.publishEvent(EventManagerImpl.java:43)
    at io.gravitee.common.event.impl.EventManagerImpl.publishEvent(EventManagerImpl.java:35)
    at io.gravitee.plugin.core.internal.PluginRegistryImpl.init(PluginRegistryImpl.java:113)
    at io.gravitee.plugin.core.internal.PluginRegistryImpl.doStart(PluginRegistryImpl.java:89)
    at io.gravitee.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:32)
    at io.gravitee.node.container.AbstractNode.startComponents(AbstractNode.java:178)
    at io.gravitee.node.container.AbstractNode.doStart(AbstractNode.java:76)
    at io.gravitee.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:32)
    at io.gravitee.node.container.AbstractContainer.doStart(AbstractContainer.java:87)
    at io.gravitee.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:32)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at io.gravitee.rest.api.standalone.boostrap.Bootstrap.start(Bootstrap.java:155)
    at io.gravitee.rest.api.standalone.boostrap.Bootstrap.main(Bootstrap.java:164)
Caused by: io.gravitee.repository.jdbc.exception.DatabaseInitializationException: Failed to set up database
    at io.gravitee.repository.jdbc.common.AbstractJdbcRepositoryConfiguration.runLiquibase(AbstractJdbcRepositoryConfiguration.java:215)
    at io.gravitee.repository.jdbc.common.AbstractJdbcRepositoryConfiguration.graviteeDataSource(AbstractJdbcRepositoryConfiguration.java:158)
    at io.gravitee.repository.jdbc.common.AbstractJdbcRepositoryConfiguration.setApplicationContext(AbstractJdbcRepositoryConfiguration.java:125)
    at org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:128)
    at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:102)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:440)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
    ... 43 common frames omitted
Caused by: java.lang.ClassCastException: class java.time.LocalDateTime cannot be cast to class java.lang.String (java.time.LocalDateTime and java.lang.String are in module java.base of loader 'bootstrap')
    at liquibase.changelog.StandardChangeLogHistoryService.getRanChangeSets(StandardChangeLogHistoryService.java:328)
    at liquibase.changelog.AbstractChangeLogHistoryService.upgradeChecksums(AbstractChangeLogHistoryService.java:66)
    at liquibase.changelog.StandardChangeLogHistoryService.upgradeChecksums(StandardChangeLogHistoryService.java:297)
    at liquibase.Liquibase.checkLiquibaseTables(Liquibase.java:1174)
    at liquibase.Liquibase.update(Liquibase.java:192)
    at liquibase.Liquibase.update(Liquibase.java:178)
    at liquibase.Liquibase.update(Liquibase.java:174)
    at io.gravitee.repository.jdbc.common.AbstractJdbcRepositoryConfiguration.runLiquibase(AbstractJdbcRepositoryConfiguration.java:213)
    ... 50 common frames omitted
10:22:27.579 [graviteeio-node] ERROR i.g.p.r.i.RepositoryPluginHandler - Unexpected error while creating context for repository instance
java.lang.IllegalStateException: org.springframework.context.annotation.AnnotationConfigApplicationContext@278150a1 has not been refreshed yet
    at org.springframework.context.support.AbstractApplicationContext.assertBeanFactoryActive(AbstractApplicationContext.java:1141)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1153)
    at io.gravitee.plugin.repository.internal.RepositoryPluginHandler.registerRepositoryDefinitions(RepositoryPluginHandler.java:159)
    at io.gravitee.plugin.repository.internal.RepositoryPluginHandler.loadRepository(RepositoryPluginHandler.java:141)
    at io.gravitee.plugin.repository.internal.RepositoryPluginHandler.handle(RepositoryPluginHandler.java:105)
    at io.gravitee.plugin.core.internal.PluginEventListener.lambda$deployPlugin$8(PluginEventListener.java:140)
    at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
    at java.base/java.util.Iterator.forEachRemaining(Unknown Source)
    at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
    at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
    at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
    at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
    at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
    at java.base/java.util.stream.ReferencePipeline.forEach(Unknown Source)
    at io.gravitee.plugin.core.internal.PluginEventListener.deployPlugin(PluginEventListener.java:138)
    at io.gravitee.plugin.core.internal.PluginEventListener.lambda$deployPlugins$5(PluginEventListener.java:121)
    at java.base/java.util.ArrayList.forEach(Unknown Source)
    at io.gravitee.plugin.core.internal.PluginEventListener.deployPlugins(PluginEventListener.java:121)
    at io.gravitee.plugin.core.internal.PluginEventListener.onEvent(PluginEventListener.java:66)
    at io.gravitee.common.event.impl.EventManagerImpl.publishEvent(EventManagerImpl.java:43)
    at io.gravitee.common.event.impl.EventManagerImpl.publishEvent(EventManagerImpl.java:35)
    at io.gravitee.plugin.core.internal.PluginRegistryImpl.init(PluginRegistryImpl.java:113)
    at io.gravitee.plugin.core.internal.PluginRegistryImpl.doStart(PluginRegistryImpl.java:89)
    at io.gravitee.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:32)
    at io.gravitee.node.container.AbstractNode.startComponents(AbstractNode.java:178)
    at io.gravitee.node.container.AbstractNode.doStart(AbstractNode.java:76)
    at io.gravitee.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:32)
    at io.gravitee.node.container.AbstractContainer.doStart(AbstractContainer.java:87)
    at io.gravitee.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:32)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at io.gravitee.rest.api.standalone.boostrap.Bootstrap.start(Bootstrap.java:155)
    at io.gravitee.rest.api.standalone.boostrap.Bootstrap.main(Bootstrap.java:164)

:sunrise_over_mountains: To Reproduce

Steps to reproduce the behaviour: Start APIM with MySql repository and driver 8.0.23 or later (currently latest is 8.0.31)

:computer: Desktop:

Please complete the following information:

:warning: Potential impacts

Which other features may be impacted by this fix. This could be populated after fix

What are the impacted versions?

:link: Dependencies

Link a story or other related things...

exalate-issue-sync[bot] commented 1 year ago

Gaetan Maisse commented: This is a known issue on {{Liquibase}} side, {{mysql-connector-java}} 8.0.23+ requires an up to date version of {{Liquibase}}:

[https://forum.liquibase.org/t/liquibaseexception-java-lang-classcastexception-class-java-time-localdatetime-cannot-be-cast-to-class-java-lang-string/5059|https://forum.liquibase.org/t/liquibaseexception-java-lang-classcastexception-class-java-time-localdatetime-cannot-be-cast-to-class-java-lang-string/5059|smart-link]

The update has been done for the 3.20 release, and it is most likely that it will not be backported to older version.

gaetanmaisse commented 1 year ago

Closing as it has done for APIM 3.20, and will be available in APIM 3.20.1 next week.