In-memory tests failed
dartartem opened this issue · 20 comments
test failed: o.eventuate.examples.tram.sagas.ordersandcustomers.integrationtests.micronaut > OrdersAndCustomersInMemoryIntegrationTest
initializationError
Caused by: io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [javax.persistence.EntityManager] exists
https://gist.github.com/dartartem/62ee7c5104161642830a56c4c8d015f6
I found the change that produced that error: dartartem/eventuate-common-1@42fc179
I rebuilt snapshots and retest to confirm, without this dartartem/eventuate-common-1@42fc179#diff-d7d990cf61eaeeb108e551894e03ecfbR15 tests passed.
Then I found that tests worked without that change because there is real datasource configured:
https://github.com/eventuate-tram/eventuate-tram-sagas/blob/master/orders-and-customers-micronaut-in-memory-integration-tests/src/test/resources/application.yml#L2
For some reason custom datasource bean creates the error on replacement. (Or if just remove the real datasource)
Unfortunately I did not find way to solve it.
Looks like micronaut does not allow to replace datasource bean for jpa.
But since we have tests on real database probably we can remove in-memory tests?
From Chris:
I don't understand this error.
The commit concerns a DataSource.
Why would that prevent an EntityManager from being created?
Did you enable trace logging for 'io.micronaut.context.condition' ?Caused by: io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [javax.persistence.EntityManager] exists. Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor).
Commit is only reveal the problem.
Test was wrongly configured to use the real database.
Actual problem that micronaut jpa can work only with default datasource created by micronaut itself.
If use custom datasource, micronaut will produce the described error.
Where in the docs does it say micronaut jpa can work only with default datasource created by micronaut itself?
What about "Did you enable trace logging for 'io.micronaut.context.condition' ?"
Where in the docs does it say micronaut jpa can work only with default datasource created by micronaut itself?`
It is in theory. I tried to remove default datasource and use custom and got the error. I read micronaut documentaion and did not find info how to configure it.
What about "Did you enable trace logging for 'io.micronaut.context.condition' ?"
No, I rebuilt eventuate-common library without @Replaces(DataSource.class).
Removed default datasource from application.yml.
So we have only custom datasource bean and jpa configured without any conditions.
Got the same error.
Did you enable trace logging for 'io.micronaut.context.condition
I am working on it now
Chris,
I added logback.xml file with:
<logger name="io.micronaut.context.condition" level="TRACE"/>
and error is changed (I checked twice) to:
io.micronaut.context.exceptions.BeanInstantiationException: Bean definition [io.eventuate.tram.sagas.micronaut.orchestration.SagaManagerImplInitializer] could not be loaded: Failed to inject value for parameter [driver] of class: io.eventuate.tram.consumer.common.DuplicateMessageDetector
Message: Error resolving property value [${datasources.default.driver-class-name}]. Property doesn't exist
Path Taken: SagaManagerImplInitializer.sagaManagers --> SagaManager.createOrderSagaManager(Saga saga,SagaInstanceRepository sagaInstanceRepository,CommandProducer commandProducer,[MessageConsumer messageConsumer],SagaLockManager sagaLockManager,SagaCommandProducer sagaCommandProducer) --> MessageConsumer.messageConsumer(MessageConsumerImplementation messageConsumerImplementation,ChannelMapping channelMapping,[DecoratedMessageHandlerFactory decoratedMessageHandlerFactory]) --> DecoratedMessageHandlerFactory.subscribedMessageHandlerChainFactory([List decorators]) --> DuplicateDetectingMessageHandlerDecorator.duplicateDetectingMessageHandlerDecorator([DuplicateMessageDetector duplicateMessageDetector]) --> DuplicateMessageDetector.duplicateMessageDetector([String driver],EventuateSchema eventuateSchema,SqlDialectSelector sqlDialectSelector,EventuateJdbcStatementExecutor eventuateJdbcStatementExecutor,EventuateTransactionTemplate eventuateTransactionTemplate)
at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1198)
at io.micronaut.context.DefaultApplicationContext.initializeContext(DefaultApplicationContext.java:236)
at io.micronaut.context.DefaultBeanContext.readAllBeanDefinitionClasses(DefaultBeanContext.java:2399)
at io.micronaut.context.DefaultBeanContext.start(DefaultBeanContext.java:199)
at io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:187)
at io.micronaut.test.extensions.AbstractMicronautExtension.startApplicationContext(AbstractMicronautExtension.java:253)
at io.micronaut.test.extensions.AbstractMicronautExtension.beforeClass(AbstractMicronautExtension.java:174)
at io.micronaut.test.extensions.junit5.MicronautJunit5Extension.beforeAll(MicronautJunit5Extension.java:49)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$7(ClassBasedTestDescriptor.java:353)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:353)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:187)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:77)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:132)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:220)
at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:188)
at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:102)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:82)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:78)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy2.stop(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:175)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:157)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:748)
Caused by: io.micronaut.context.exceptions.DependencyInjectionException: Failed to inject value for parameter [driver] of class: io.eventuate.tram.consumer.common.DuplicateMessageDetector
Message: Error resolving property value [${datasources.default.driver-class-name}]. Property doesn't exist
Path Taken: SagaManagerImplInitializer.sagaManagers --> SagaManager.createOrderSagaManager(Saga saga,SagaInstanceRepository sagaInstanceRepository,CommandProducer commandProducer,[MessageConsumer messageConsumer],SagaLockManager sagaLockManager,SagaCommandProducer sagaCommandProducer) --> MessageConsumer.messageConsumer(MessageConsumerImplementation messageConsumerImplementation,ChannelMapping channelMapping,[DecoratedMessageHandlerFactory decoratedMessageHandlerFactory]) --> DecoratedMessageHandlerFactory.subscribedMessageHandlerChainFactory([List decorators]) --> DuplicateDetectingMessageHandlerDecorator.duplicateDetectingMessageHandlerDecorator([DuplicateMessageDetector duplicateMessageDetector]) --> DuplicateMessageDetector.duplicateMessageDetector([String driver],EventuateSchema eventuateSchema,SqlDialectSelector sqlDialectSelector,EventuateJdbcStatementExecutor eventuateJdbcStatementExecutor,EventuateTransactionTemplate eventuateTransactionTemplate)
at io.micronaut.context.AbstractBeanDefinition.getValueForConstructorArgument(AbstractBeanDefinition.java:1040)
at io.eventuate.tram.micronaut.consumer.jdbc.$TramConsumerJdbcFactory$DuplicateMessageDetector0Definition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1535)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:2248)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:1917)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:1892)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1021)
at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:985)
at io.eventuate.tram.micronaut.consumer.common.$TramConsumerBaseCommonFactory$DuplicateDetectingMessageHandlerDecorator2Definition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1535)
at io.micronaut.context.DefaultBeanContext.addCandidateToList(DefaultBeanContext.java:2581)
at io.micronaut.context.DefaultBeanContext.getBeansOfTypeInternal(DefaultBeanContext.java:2503)
at io.micronaut.context.DefaultBeanContext.getBeansOfType(DefaultBeanContext.java:870)
at io.micronaut.context.AbstractBeanDefinition.lambda$getBeansOfTypeForConstructorArgument$10(AbstractBeanDefinition.java:1092)
at io.micronaut.context.AbstractBeanDefinition.resolveBeanWithGenericsFromConstructorArgument(AbstractBeanDefinition.java:1730)
at io.micronaut.context.AbstractBeanDefinition.getBeansOfTypeForConstructorArgument(AbstractBeanDefinition.java:1087)
at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:962)
at io.eventuate.tram.micronaut.consumer.common.$TramConsumerBaseCommonFactory$SubscribedMessageHandlerChainFactory0Definition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1535)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:2248)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:1917)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:1892)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1021)
at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:985)
at io.eventuate.tram.micronaut.consumer.common.$TramConsumerCommonFactory$MessageConsumer0Definition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1535)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:2248)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:1917)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:1892)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1021)
at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:985)
at io.eventuate.examples.tram.sagas.ordersandcustomers.micronaut.orders.$OrderFactory$CreateOrderSagaManager1Definition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1535)
at io.micronaut.context.DefaultBeanContext.addCandidateToList(DefaultBeanContext.java:2581)
at io.micronaut.context.DefaultBeanContext.getBeansOfTypeInternal(DefaultBeanContext.java:2503)
at io.micronaut.context.DefaultBeanContext.getBeansOfType(DefaultBeanContext.java:870)
at io.micronaut.context.AbstractBeanDefinition.lambda$getBeansOfTypeForField$15(AbstractBeanDefinition.java:1446)
at io.micronaut.context.AbstractBeanDefinition.resolveBeanWithGenericsForField(AbstractBeanDefinition.java:1749)
at io.micronaut.context.AbstractBeanDefinition.getBeansOfTypeForField(AbstractBeanDefinition.java:1441)
at io.micronaut.context.AbstractBeanDefinition.getBeanForField(AbstractBeanDefinition.java:1357)
at io.micronaut.context.AbstractBeanDefinition.injectBeanField(AbstractBeanDefinition.java:714)
at io.eventuate.tram.sagas.micronaut.orchestration.$SagaManagerImplInitializerDefinition.injectBean(Unknown Source)
at io.eventuate.tram.sagas.micronaut.orchestration.$SagaManagerImplInitializerDefinition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1535)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:2248)
at io.micronaut.context.DefaultBeanContext.loadContextScopeBean(DefaultBeanContext.java:1829)
at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1196)
... 67 more
I am continuing investigation
I replaced current duplicate messaging detector by noop version.
Got the same
No bean of type [javax.persistence.EntityManager] exists.
With log:
?[36m18:21:53.473?[0;39m ?[1;30m[Test worker]?[0;39m ?[34mINFO ?[0;39m ?[35mi.m.context.env.DefaultEnvironment?[0;39m - Established active environments: [test]
?[36m18:21:53.779?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - Configuration: io.micronaut.configuration.hibernate.jpa.jcache will not be loaded due to failing conditions:
?[36m18:21:53.779?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - * Class [javax.cache.CacheManager] is not present
?[36m18:21:53.986?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - Bean [io.micronaut.configuration.hibernate.jpa.metrics.$HibernateMetricsBinderDefinition] will not be loaded due to failing conditions:
?[36m18:21:53.987?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - * Class [io.micrometer.core.instrument.MeterRegistry] is not present
?[36m18:21:54.002?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - Bean [Definition: io.micronaut.jdbc.spring.DataSourceTransactionManagerFactory] will not be loaded due to failing conditions:
?[36m18:21:54.002?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - * Custom condition [class io.micronaut.jdbc.spring.HibernatePresenceCondition] failed evaluation
?[36m18:21:54.010?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - Bean [io.micronaut.reactive.reactor.converters.$PublisherToMonoConverterDefinition] will not be loaded due to failing conditions:
?[36m18:21:54.010?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - * Class [reactor.core.publisher.Mono] is not present
?[36m18:21:54.010?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - Bean [io.micronaut.reactive.reactor.converters.$ObjectToFluxConverterDefinition] will not be loaded due to failing conditions:
?[36m18:21:54.010?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - * Class [reactor.core.publisher.Flux] is not present
?[36m18:21:54.010?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - Bean [io.micronaut.reactive.reactor.converters.$PublisherToFluxConverterDefinition] will not be loaded due to failing conditions:
?[36m18:21:54.011?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - * Class [reactor.core.publisher.Flux] is not present
?[36m18:21:54.011?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - Bean [io.micronaut.reactive.reactor.converters.$ObjectToMonoConverterDefinition] will not be loaded due to failing conditions:
?[36m18:21:54.011?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - * Class [reactor.core.publisher.Flux] is not present
?[36m18:21:54.030?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - Bean [io.micronaut.reactive.rxjava1.converters.$RxJava1ConverterRegistrarDefinition] will not be loaded due to failing conditions:
?[36m18:21:54.030?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - * Class [hu.akarnokd.rxjava.interop.RxJavaInterop] is not present
?[36m18:21:54.275?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - Bean [Definition: io.micronaut.configuration.hibernate.jpa.EntityManagerFactoryBean] will not be loaded due to failing conditions:
?[36m18:21:54.275?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - * No bean of type [class org.hibernate.boot.MetadataSources] present within context
?[36m18:21:54.275?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - Bean [Definition: io.micronaut.configuration.hibernate.jpa.EntityManagerFactoryBean] will not be loaded due to failing conditions:
?[36m18:21:54.275?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - * No bean of type [interface org.hibernate.boot.SessionFactoryBuilder] present within context
?[36m18:21:54.279?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - Bean [io.micronaut.reactive.reactor.$ReactorInstrumentationDefinition] will not be loaded due to failing conditions:
?[36m18:21:54.279?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - * Class [reactor.core.publisher.Flux] is not present
?[36m18:21:54.290?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - Bean [Definition: io.eventuate.tram.micronaut.messaging.common.TramMessagingCommonFactory] will not be loaded due to failing conditions:
?[36m18:21:54.291?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - * Existing bean [io.eventuate.tram.messaging.common.ChannelMapping] of type [interface io.eventuate.tram.messaging.common.ChannelMapping] registered in context
?[36m18:21:54.514?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - Bean [Definition: io.micronaut.configuration.hibernate.jpa.EntityManagerFactoryBean] will not be loaded due to failing conditions:
?[36m18:21:54.514?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - * No bean of type [interface org.hibernate.boot.SessionFactoryBuilder] present within context
?[36m18:21:54.518?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - Bean [io.micronaut.health.$HeartbeatTaskDefinition] will not be loaded due to failing conditions:
?[36m18:21:54.518?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - * Required property [micronaut.application.name] with value [null] not present
?[36m18:21:54.520?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - Bean [io.micronaut.runtime.server.watch.event.$FileWatchRestartListenerDefinition] will not be loaded due to failing conditions:
?[36m18:21:54.520?[0;39m ?[1;30m[Test worker]?[0;39m ?[39mDEBUG?[0;39m ?[35mi.m.context.condition.Condition?[0;39m - * Property [micronaut.io.watch.restart] with value [false] does not equal required value: true
These are relevant:
Bean [Definition: io.micronaut.jdbc.spring.DataSourceTransactionManagerFactory] will not be loaded due to failing conditions:
Custom condition [class io.micronaut.jdbc.spring.HibernatePresenceCondition] failed evaluation
Bean [Definition: io.micronaut.configuration.hibernate.jpa.EntityManagerFactoryBean] will not be loaded due to failing conditions:
* No bean of type [class org.hibernate.boot.MetadataSources] present within context
Bean [Definition: io.micronaut.configuration.hibernate.jpa.EntityManagerFactoryBean] will not be loaded due to failing conditions:
* No bean of type [interface org.hibernate.boot.SessionFactoryBuilder] present within context
yes, I seen.
HibernatePresenceCondition failed because there is no bean of HibernateTransactionManagerFactory
EntityManagerFactoryBean is not loaded because there are no SessionFactoryBuilder and MetadataSources.
There is no clue why.
But thank you for the link, it provides more info:
SessionFactoryBuilder requires MetadataSources.
MetadataSources has @RequiresHibernateEntities
it is the following:
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PACKAGE, ElementType.TYPE, ElementType.METHOD})
@Requires(classes = MetadataSource.class)
@Requires(beans = JpaConfiguration.class)
@Requires(condition = EntitiesInPackageCondition.class)
public @interface RequiresHibernateEntities {
}
MetadataSource is part org.hibernate:hibernate-core artifact which is present.
jpa is configured right because it worked with the real database
jpa:
default:
packages-to-scan:
- 'io.eventuate.examples.tram.sagas.ordersandcustomers'
properties:
hibernate:
hbm2ddl:
auto: update
show_sql: true
Entities are in package.
So all conditions are satisfied.
A similar problem: https://stackoverflow.com/questions/58053152/setting-datasource-programmatically-in-micronaut-hibernate-for-heroku-postgres
solution is to use configuration properties:
datasources:
default:
...
It works, but it is not our case.
There is advice to make datasource primary and use @singleton instead of @bean.
Our data source is singleton, but not primary. I will try to make in primary.
Googling micronaut No bean of type [javax.persistence.EntityManager] exists
found a few things:
https://gitter.im/micronautfw/questions?at=5ca3427c93fb4a7dc2bf3107
Graeme Rocher @graemerocher Apr 02 2019 04:08
@AnandAili make sure the bean is @nAmed(“..”) something
@cer @primary did not help. Tomorrow I will check https://gitter.im/micronautfw/questions?at=5ca3427c93fb4a7dc2bf3107
In the docs https://docs.micronaut.io/latest/guide/index.html#eachBean:
Note that @EachBean requires that the parent bean has a @nAmed qualifier, since the qualifier is inherited by each bean created by @EachBean.
@dartartem Why @Named("default")
vs @Named
vs. No @Named
?
@cer Chris because it is name of datasource used by default as primary bean.
I seen this in code of io.micronaut.configuration.jdbc.hikari.DatasourceConfiguration:
https://github.com/micronaut-projects/micronaut-sql/blob/master/jdbc-hikari/src/main/java/io/micronaut/configuration/jdbc/hikari/DatasourceConfiguration.java#L43
And I even did not think that is possible to use @nAmed without actual name, but it seems it is the same as just not use @nAmed.
Hi, I don't know if this is related but I am seeing the following in my Quarkus project with java11.
No bean found for required type [interface io.eventuate.tram.consumer.common.MessageConsumerImplementation]
I am using Maven dependency eventuate-tram-consumer-common 0.29.0.RELEASE
And following the series of examples: eventuate-tram-examples-quarkus-customers-and-orders
Hi, I don't know if this is related but I am seeing the following in my Quarkus project with java11.
No bean found for required type [interface io.eventuate.tram.consumer.common.MessageConsumerImplementation]
I am using Maven dependency eventuate-tram-consumer-common 0.29.0.RELEASE
And following the series of examples: eventuate-tram-examples-quarkus-customers-and-orders
Hello @JaredZena, no, it is not related.
It seems you are using the wrong dependency, eventuate-tram-consumer-common - does not contain any beans.
It just contains common classes definition.
Probably you need io.eventuate.tram.core:eventuate-tram-quarkus-consumer-kafka
dependency.
We recommend to use it via io.eventuate.platform:eventuate-platform-dependencies
If you will need further assistance, please create and share minimal project on gitgub that reproduces problem.
Hi @dartartem ,
Thanks for your quick reply, I have created a minimal Github repository to reproduce the problem.
I have added the kafka dependency as well however, I am not intended to use kafka server.
I want to use a CDC with RabbitMQ and Zookeeper in order to integrate events with other Spring Boot and Quarkus Maven projects as well.
In my Spring Boot projects everything works fine with the gven Eventuate dependencies for spring.
I would appreciate it if you can take a look to my repo and let me know how can I overcome this problem as I mentioned i am not intended to use Kafka.
Github repository:
Hi @dartartem ,
Thanks for your quick reply, I have created a minimal Github repository to reproduce the problem.
I have added the kafka dependency as well however, I am not intended to use kafka server.
I want to use a CDC with RabbitMQ and Zookeeper in order to integrate events with other Spring Boot and Quarkus Maven projects as well.
In my Spring Boot projects everything works fine with the gven Eventuate dependencies for spring.
I would appreciate it if you can take a look to my repo and let me know how can I overcome this problem as I mentioned i am not intended to use Kafka.
Github repository:
Hi @JaredZena, unfortunately only kafka is supported now for quarkus version of Eventuate Framework.