I have a Quarkus application which has a default reactive postgres data source and jdbc db2 data source. I cannot go with reactive db2 data source because of existing open issue (https://github.com/eclipse-vertx/vertx-sql-client/issues/1131).
During application startup Hibernate ORM is not able to pick the default datasource in the application.properties file and throws error
Exception: Model classes are defined for the default persistence unit, but no default datasource was found. The default EntityManagerFactory will not be created. To solve this, configu
re the default datasource. Refer to https://quarkus.io/guides/datasource for guidance.
at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.handleHibernateORMWithNoPersistenceXml(HibernateOrmProcessor.java:932)
at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.configurationDescriptorBuilding(HibernateOrmProcessor.java:420)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:882)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:833)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
application.properties
# Postgres reactive datasource
quarkus.datasource.db-kind=postgresql
quarkus.datasource.jdbc=false
quarkus.datasource.reactive.url=***
quarkus.datasource.username=***
quarkus.datasource.password=***
#DB2 Agoral data source
quarkus.datasource.legacy.db-kind=db2
quarkus.datasource.legacy.reactive=false
quarkus.datasource.legacy.jdbc.url=***
quarkus.datasource.legacy.username=***
quarkus.datasource.legacy.password=***
Hibernate ORM Picks the default data source and everything works fine when the application has only the default data source. Please let me know if I am missing any configuration here. THanks.