Quarkus: Adding Hibernate panache dependency + driver and no config leads to error

Created on 28 Mar 2019  路  2Comments  路  Source: quarkusio/quarkus

When I add Hibernate Panache as a dependency, and do mvn compile quarkus:dev, I get

        [error]: Build step io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor#doParseAndRegisterSubstrateResources threw an exception: io.quark
us.deployment.configuration.ConfigurationError: Hibernate extension cannot guess the dialect as no JDBC driver is specified by 'quarkus.datasource.driv
er'
        at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:134)
        at io.quarkus.dev.DevModeMain.doStart(DevModeMain.java:105)
        at io.quarkus.dev.DevModeMain.main(DevModeMain.java:66)
Caused by: org.jboss.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor#doParseAndRegisterSubstrateResources threw an exception: io.quark
us.deployment.configuration.ConfigurationError: Hibernate extension cannot guess the dialect as no JDBC driver is specified by 'quarkus.datasource.driv
er'
        at org.jboss.builder.Execution.run(Execution.java:123)
        at org.jboss.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:136)
        at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:110)
        at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:99)
        ... 2 more
Caused by: io.quarkus.deployment.configuration.ConfigurationError: Hibernate extension cannot guess the dialect as no JDBC driver is specified by 'quar
kus.datasource.driver'
        at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.guessDialect(HibernateOrmProcessor.java:473)
        at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.handleHibernateORMWithNoPersistenceXml(HibernateOrmProcessor.java:330)
        at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.doParseAndRegisterSubstrateResources(HibernateOrmProcessor.java:127)
        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 io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:506)
        at org.jboss.builder.BuildContext.run(BuildContext.java:413)
        at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1998)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1525)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1416)
        at java.lang.Thread.run(Thread.java:748)
        at org.jboss.threads.JBossThread.run(JBossThread.java:479)

Note that I have no @Entity annotations. I think we did fix that issue in the past @gsmet but it might have resurfaced.

arepanache arepersistence kinbug

Most helpful comment

We only "start" ORM if there are entities in the classpath. The issue is that it's entities in the large sense of the term (embeddables and mapped super classes are considered too) and with Panache, we have one abstract mapped super class: PanacheEntity.

Thus it tries to start ORM and you have this error.

We should probably be stricter and only start ORM if we have at least one class marked with @Entity.

All 2 comments

We only "start" ORM if there are entities in the classpath. The issue is that it's entities in the large sense of the term (embeddables and mapped super classes are considered too) and with Panache, we have one abstract mapped super class: PanacheEntity.

Thus it tries to start ORM and you have this error.

We should probably be stricter and only start ORM if we have at least one class marked with @Entity.

I have a patch for it but it's a bit more invasive than planned and we release soon. Let's move it to the next release.

Was this page helpful?
0 / 5 - 0 ratings