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

[since 3.0] ClassNotFoundException: io.r2dbc.pool.ConnectionPool #377

Open
Brutus5000 opened this issue May 30, 2023 · 0 comments
Open

[since 3.0] ClassNotFoundException: io.r2dbc.pool.ConnectionPool #377

Brutus5000 opened this issue May 30, 2023 · 0 comments

Comments

@Brutus5000
Copy link

Brutus5000 commented May 30, 2023

Expected Behavior

If I do not use connection settings that enable pooling, I should not need io.r2dbc:r2dbc-pool.
However, in some scenarios (micrometer?) it seems to be required still.

Actual Behaviour

When upgrading from Micronaut 3.4.x to 3.5.x (thus introducing micronaut-r2dbc 3.x), my tests start to fail:

Bean definition [io.micronaut.data.r2dbc.config.R2dbcSchemaGenerator] could not be loaded: Error instantiating bean of type  [io.micronaut.configuration.metrics.aggregator.MeterRegistryConfigurer]

Message: io/r2dbc/pool/ConnectionPool
Path Taken: CompositeMeterRegistry.compositeMeterRegistry(List registries,List configurers) --> CompositeMeterRegistry.compositeMeterRegistry(List registries,[List configurers]) --> MeterRegistryConfigurer.meterRegistryConfigurer([Collection binders],Collection filters)
io.micronaut.context.exceptions.BeanInstantiationException: Bean definition [io.micronaut.data.r2dbc.config.R2dbcSchemaGenerator] could not be loaded: Error instantiating bean of type  [io.micronaut.configuration.metrics.aggregator.MeterRegistryConfigurer]

Message: io/r2dbc/pool/ConnectionPool
Path Taken: CompositeMeterRegistry.compositeMeterRegistry(List registries,List configurers) --> CompositeMeterRegistry.compositeMeterRegistry(List registries,[List configurers]) --> MeterRegistryConfigurer.meterRegistryConfigurer([Collection binders],Collection filters)
	at app//io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1921)
	at app//io.micronaut.context.DefaultApplicationContext.initializeContext(DefaultApplicationContext.java:245)
	at app//io.micronaut.context.DefaultBeanContext.readAllBeanDefinitionClasses(DefaultBeanContext.java:3326)
	at app//io.micronaut.context.DefaultBeanContext.finalizeConfiguration(DefaultBeanContext.java:3684)
	at app//io.micronaut.context.DefaultBeanContext.start(DefaultBeanContext.java:341)
	at app//io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:190)
	at app//io.micronaut.test.extensions.AbstractMicronautExtension.startApplicationContext(AbstractMicronautExtension.java:433)
	at app//io.micronaut.test.extensions.AbstractMicronautExtension.beforeClass(AbstractMicronautExtension.java:314)
	at app//io.micronaut.test.extensions.junit5.MicronautJunit5Extension.beforeAll(MicronautJunit5Extension.java:83)
	at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$12(ClassBasedTestDescriptor.java:395)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:395)
	at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:211)
	at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:84)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:148)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)
	at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
	at app//org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
	at app//org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
	at app//org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:110)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:90)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:85)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:62)
	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:568)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
	at jdk.proxy1/jdk.proxy1.$Proxy2.stop(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
	at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
Caused by: io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type  [io.micronaut.configuration.metrics.aggregator.MeterRegistryConfigurer]

Message: io/r2dbc/pool/ConnectionPool
Path Taken: CompositeMeterRegistry.compositeMeterRegistry(List registries,List configurers) --> CompositeMeterRegistry.compositeMeterRegistry(List registries,[List configurers]) --> MeterRegistryConfigurer.meterRegistryConfigurer([Collection binders],Collection filters)
	at app//io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2367)
	at app//io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2305)
	at app//io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2251)
	at app//io.micronaut.context.DefaultBeanContext.createRegistration(DefaultBeanContext.java:3016)
	at app//io.micronaut.context.SingletonScope.getOrCreate(SingletonScope.java:80)
	at app//io.micronaut.context.DefaultBeanContext.findOrCreateSingletonBeanRegistration(DefaultBeanContext.java:2918)
	at app//io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2879)
	at app//io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2853)
	at app//io.micronaut.context.DefaultBeanContext.addCandidateToList(DefaultBeanContext.java:3511)
	at app//io.micronaut.context.DefaultBeanContext.resolveBeanRegistrations(DefaultBeanContext.java:3457)
	at app//io.micronaut.context.DefaultBeanContext.getBeanRegistrations(DefaultBeanContext.java:3427)
	at app//io.micronaut.context.DefaultBeanContext.getBeansOfType(DefaultBeanContext.java:1381)
	at app//io.micronaut.context.AbstractBeanResolutionContext.getBeansOfType(AbstractBeanResolutionContext.java:72)
	at app//io.micronaut.context.AbstractInitializableBeanDefinition.resolveBeansOfType(AbstractInitializableBeanDefinition.java:2161)
	at app//io.micronaut.context.AbstractInitializableBeanDefinition.getBeansOfTypeForConstructorArgument(AbstractInitializableBeanDefinition.java:1437)
	at app//io.micronaut.configuration.metrics.micrometer.$MeterRegistryFactory$MeterRegistryConfigurer1$Definition.build(Unknown Source)
	at app//io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2354)
	at app//io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2305)
	at app//io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2251)
	at app//io.micronaut.context.DefaultBeanContext.createRegistration(DefaultBeanContext.java:3016)
	at app//io.micronaut.context.SingletonScope.getOrCreate(SingletonScope.java:80)
	at app//io.micronaut.context.DefaultBeanContext.findOrCreateSingletonBeanRegistration(DefaultBeanContext.java:2918)
	at app//io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2879)
	at app//io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2853)
	at app//io.micronaut.context.DefaultBeanContext.addCandidateToList(DefaultBeanContext.java:3511)
	at app//io.micronaut.context.DefaultBeanContext.resolveBeanRegistrations(DefaultBeanContext.java:3457)
	at app//io.micronaut.context.DefaultBeanContext.getBeanRegistrations(DefaultBeanContext.java:3427)
	at app//io.micronaut.context.DefaultBeanContext.getBeansOfType(DefaultBeanContext.java:1381)
	at app//io.micronaut.context.AbstractBeanResolutionContext.getBeansOfType(AbstractBeanResolutionContext.java:72)
	at app//io.micronaut.context.AbstractInitializableBeanDefinition.resolveBeansOfType(AbstractInitializableBeanDefinition.java:2161)
	at app//io.micronaut.context.AbstractInitializableBeanDefinition.getBeansOfTypeForConstructorArgument(AbstractInitializableBeanDefinition.java:1437)
	at app//io.micronaut.configuration.metrics.micrometer.$MeterRegistryFactory$CompositeMeterRegistry0$Definition.build(Unknown Source)
	at app//io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2354)
	at app//io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2305)
	at app//io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2251)
	at app//io.micronaut.context.DefaultBeanContext.createRegistration(DefaultBeanContext.java:3016)
	at app//io.micronaut.context.SingletonScope.getOrCreate(SingletonScope.java:80)
	at app//io.micronaut.context.DefaultBeanContext.findOrCreateSingletonBeanRegistration(DefaultBeanContext.java:2918)
	at app//io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2879)
	at app//io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2800)
	at app//io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1617)
	at app//io.micronaut.inject.provider.BeanProviderDefinition$1.get(BeanProviderDefinition.java:81)
	at app//io.micronaut.configuration.metrics.binder.executor.ExecutorServiceMetricsBinder.onCreated(ExecutorServiceMetricsBinder.java:75)
	at app//io.micronaut.configuration.metrics.binder.executor.ExecutorServiceMetricsBinder.onCreated(ExecutorServiceMetricsBinder.java:48)
	at app//io.micronaut.context.DefaultBeanContext.triggerBeanCreatedEventListener(DefaultBeanContext.java:2407)
	at app//io.micronaut.context.DefaultBeanContext.postBeanCreated(DefaultBeanContext.java:2385)
	at app//io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2309)
	at app//io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2251)
	at app//io.micronaut.context.DefaultBeanContext.createRegistration(DefaultBeanContext.java:3016)
	at app//io.micronaut.context.SingletonScope.getOrCreate(SingletonScope.java:80)
	at app//io.micronaut.context.DefaultBeanContext.findOrCreateSingletonBeanRegistration(DefaultBeanContext.java:2918)
	at app//io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2879)
	at app//io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2800)
	at app//io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1617)
	at app//io.micronaut.context.AbstractBeanResolutionContext.getBean(AbstractBeanResolutionContext.java:66)
	at app//io.micronaut.context.AbstractInitializableBeanDefinition.resolveBean(AbstractInitializableBeanDefinition.java:2065)
	at app//io.micronaut.context.AbstractInitializableBeanDefinition.getBeanForConstructorArgument(AbstractInitializableBeanDefinition.java:1297)
	at app//io.micronaut.data.r2dbc.operations.$DefaultR2dbcRepositoryOperations$Definition.doBuild(Unknown Source)
	at app//io.micronaut.context.AbstractInitializableBeanDefinition.build(AbstractInitializableBeanDefinition.java:769)
	at app//io.micronaut.context.BeanDefinitionDelegate.build(BeanDefinitionDelegate.java:158)
	at app//io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2354)
	at app//io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2305)
	at app//io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2251)
	at app//io.micronaut.context.DefaultBeanContext.createRegistration(DefaultBeanContext.java:3016)
	at app//io.micronaut.context.SingletonScope.getOrCreate(SingletonScope.java:80)
	at app//io.micronaut.context.DefaultBeanContext.findOrCreateSingletonBeanRegistration(DefaultBeanContext.java:2918)
	at app//io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2879)
	at app//io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2800)
	at app//io.micronaut.context.DefaultBeanContext.findBean(DefaultBeanContext.java:1680)
	at app//io.micronaut.context.BeanDefinitionDelegate.getParametersValues(BeanDefinitionDelegate.java:195)
	at app//io.micronaut.context.BeanDefinitionDelegate.build(BeanDefinitionDelegate.java:157)
	at app//io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2354)
	at app//io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2305)
	at app//io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2251)
	at app//io.micronaut.context.DefaultBeanContext.createRegistration(DefaultBeanContext.java:3016)
	at app//io.micronaut.context.SingletonScope.getOrCreate(SingletonScope.java:80)
	at app//io.micronaut.context.DefaultBeanContext.findOrCreateSingletonBeanRegistration(DefaultBeanContext.java:2918)
	at app//io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2879)
	at app//io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2853)
	at app//io.micronaut.context.DefaultBeanContext.addCandidateToList(DefaultBeanContext.java:3511)
	at app//io.micronaut.context.DefaultBeanContext.resolveBeanRegistrations(DefaultBeanContext.java:3457)
	at app//io.micronaut.context.DefaultBeanContext.getBeanRegistrations(DefaultBeanContext.java:3427)
	at app//io.micronaut.context.DefaultBeanContext.getBeansOfType(DefaultBeanContext.java:1381)
	at app//io.micronaut.context.AbstractBeanResolutionContext.getBeansOfType(AbstractBeanResolutionContext.java:72)
	at app//io.micronaut.context.AbstractInitializableBeanDefinition.resolveBeansOfType(AbstractInitializableBeanDefinition.java:2161)
	at app//io.micronaut.context.AbstractInitializableBeanDefinition.getBeansOfTypeForConstructorArgument(AbstractInitializableBeanDefinition.java:1437)
	at app//io.micronaut.data.r2dbc.config.$R2dbcSchemaGenerator$Definition.build(Unknown Source)
	at app//io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2354)
	at app//io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2305)
	at app//io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2251)
	at app//io.micronaut.context.DefaultBeanContext.createRegistration(DefaultBeanContext.java:3016)
	at app//io.micronaut.context.SingletonScope.getOrCreate(SingletonScope.java:80)
	at app//io.micronaut.context.DefaultBeanContext.findOrCreateSingletonBeanRegistration(DefaultBeanContext.java:2918)
	at app//io.micronaut.context.DefaultBeanContext.loadContextScopeBean(DefaultBeanContext.java:2746)
	at app//io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1915)
	... 65 more
Caused by: java.lang.NoClassDefFoundError: io/r2dbc/pool/ConnectionPool
	at io.micronaut.configuration.metrics.binder.r2dbc.R2dbcPoolMetricsBinderFactory.r2dbcPoolMeterBinder(R2dbcPoolMetricsBinderFactory.java:57)
	at io.micronaut.configuration.metrics.binder.r2dbc.$R2dbcPoolMetricsBinderFactory$R2dbcPoolMeterBinder0$Definition.doBuild(Unknown Source)
	at io.micronaut.context.AbstractInitializableBeanDefinition.build(AbstractInitializableBeanDefinition.java:769)
	at io.micronaut.context.BeanDefinitionDelegate.build(BeanDefinitionDelegate.java:158)
	at io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2354)
	... 159 more
Caused by: java.lang.ClassNotFoundException: io.r2dbc.pool.ConnectionPool
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
	... 164 more

Adding io.r2dbc:r2dbc-pool to the dependencies solves this error, but should not be required.

Steps To Reproduce

  1. In the example application just run the tests in ApplicationIT class.
  2. This does not appear 1 commit earlier (which is Micronaut 3.4.2 / Micronaut-R2DBC 2.x)

Environment Information

  • Operating system: Arch Linux
  • JDK: OpenJDK 17
  • Gradle: 8.1.1

Example Application

https://github.com/FAForever/faf-user-service/tree/maintenance/micronaut-3.5.x

Version

Micronaut 3.5.0 and onwards / Micronaut-R2DBC 3.0.0 and onwards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant