Home > Software engineering >  hibernate-orm-panache-kotlin with reactive datasource
hibernate-orm-panache-kotlin with reactive datasource

Time:09-18

I'm trying to setup hibernate-orm-panache-kotlin with reactive Postgres datasource, very same setup as described in https://github.com/quarkiverse/quarkus-vault/issues/78#issue-1374638528

Yet, I'm getting the following exception when trying to persist some data via io.quarkus.hibernate.orm.panache.kotlin.PanacheRepositoryBase:


2022-09-16T12:46:44.287898821Z 2022-09-16 12:46:44,282 ERROR [org.jbo.res.rea.com.cor.AbstractResteasyReactiveContext] (vert.x-eventloop-thread-4) Request failed: java.lang.IllegalStateException: The named datasource 'default-reactive' has not been properly configured. See https://quarkus.io/guides/datasource#multiple-datasources for information on how to do that.
2022-09-16T12:46:44.287979236Z  at io.quarkus.hibernate.orm.panache.common.runtime.AbstractJpaOperations.getEntityManager(AbstractJpaOperations.java:76)
2022-09-16T12:46:44.287991304Z  at io.quarkus.hibernate.orm.panache.common.runtime.AbstractJpaOperations.getEntityManager(AbstractJpaOperations.java:51)
2022-09-16T12:46:44.287995544Z  at io.quarkus.hibernate.orm.panache.common.runtime.AbstractJpaOperations.persist(AbstractJpaOperations.java:93)
2022-09-16T12:46:44.287999109Z  at io.quarkus.hibernate.orm.panache.kotlin.PanacheRepositoryBase$DefaultImpls.persistAndFlush(PanacheRepositoryBase.kt:61)
2022-09-16T12:46:44.288002631Z  at com.payxpert.exchangerate.data.repository.ExchangeRateRepository.persistAndFlush(ExchangeRateRepository.kt:8)
2022-09-16T12:46:44.288006234Z  at com.payxpert.exchangerate.data.repository.ExchangeRateRepository.persistAndFlush(ExchangeRateRepository.kt:8)
2022-09-16T12:46:44.288009583Z  at com.payxpert.exchangerate.data.repository.ExchangeRateRepository_ClientProxy.persistAndFlush(Unknown Source)
2022-09-16T12:46:44.288012970Z  at com.payxpert.exchangerate.service.ExchangeRateService.getExchangeRate$suspendImpl(ExchangeRateService.kt:32)
2022-09-16T12:46:44.288016345Z  at com.payxpert.exchangerate.service.ExchangeRateService.getExchangeRate(ExchangeRateService.kt)
2022-09-16T12:46:44.288019769Z  at com.payxpert.exchangerate.service.ExchangeRateService_ClientProxy.getExchangeRate(Unknown Source)
2022-09-16T12:46:44.288023053Z  at com.payxpert.exchangerate.controller.ExchangeRateController.getExchangeRate$suspendImpl(ExchangeRateController.kt:25)
2022-09-16T12:46:44.288026472Z  at com.payxpert.exchangerate.controller.ExchangeRateController.getExchangeRate(ExchangeRateController.kt)
2022-09-16T12:46:44.288029972Z  at com.payxpert.exchangerate.controller.ExchangeRateController$quarkuscoroutineinvoker$getExchangeRate_66c797082ca56a703eb08f34be10b1d88f61d5f8.invokeCoroutine(Unknown Source)
2022-09-16T12:46:44.288033458Z  at org.jboss.resteasy.reactive.server.runtime.kotlin.CoroutineInvocationHandler$handle$1.invokeSuspend(CoroutineInvocationHandler.kt:40)
2022-09-16T12:46:44.288038057Z  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2022-09-16T12:46:44.288041480Z  at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
2022-09-16T12:46:44.288059843Z  at org.jboss.resteasy.reactive.server.runtime.kotlin.VertxDispatcher.dispatch$lambda-0(ApplicationCoroutineScope.kt:39)
2022-09-16T12:46:44.288073680Z  at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
2022-09-16T12:46:44.288077043Z  at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:246)
2022-09-16T12:46:44.288080285Z  at io.vertx.core.impl.EventLoopContext.lambda$runOnContext$0(EventLoopContext.java:43)
2022-09-16T12:46:44.288083420Z  at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
2022-09-16T12:46:44.288086529Z  at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
2022-09-16T12:46:44.288089694Z  at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
2022-09-16T12:46:44.288092851Z  at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:503)
2022-09-16T12:46:44.288095983Z  at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
2022-09-16T12:46:44.288099147Z  at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
2022-09-16T12:46:44.288102260Z  at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
2022-09-16T12:46:44.288105519Z  at java.base/java.lang.Thread.run(Thread.java:829)

Is there something I've missed, or hibernate-orm-panache-kotlin just doesn't work with reactive datasources? When switching from hibernate-orm-panache-kotlin to hibernate-reactive-panache everything works as expected.

CodePudding user response:

Hibernate ORM Panache does not work with reactive datasources. You'll need to use Hibernate Reactive Panache

  • Related