Describe the bug
I'm trying to start Quarkus by running mvn compile quarkus:dev command and passing the system property -DSKIP_PARSE_PERSISTENCE_XML property. It fails with the following error:
`2020-10-13 17:39:29,254 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor#build threw an exception: java.lang.UnsupportedOperationException: Value found for #getJtaDataSource : not supported yet
at io.quarkus.hibernate.orm.runtime.boot.LightPersistenceXmlDescriptor.verifyIgnoredFields(LightPersistenceXmlDescriptor.java:164)
at io.quarkus.hibernate.orm.runtime.boot.LightPersistenceXmlDescriptor.validateAndReadFrom(LightPersistenceXmlDescriptor.java:55)
at io.quarkus.hibernate.orm.runtime.boot.QuarkusPersistenceUnitDefinition.
at io.quarkus.hibernate.orm.deployment.PersistenceUnitDescriptorBuildItem.asOutputPersistenceUnitDefinition(PersistenceUnitDescriptorBuildItem.java:55)
at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.build(HibernateOrmProcessor.java:361)
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$2.execute(ExtensionLoader.java:932)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:253)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:134)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:54)
at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:75)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:349)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:51)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:132)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:85)
at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:144)
at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:63)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor#build threw an exception: java.lang.UnsupportedOperationException: Value found for #getJtaDataSource : not supported yet
at io.quarkus.hibernate.orm.runtime.boot.LightPersistenceXmlDescriptor.verifyIgnoredFields(LightPersistenceXmlDescriptor.java:164)
at io.quarkus.hibernate.orm.runtime.boot.LightPersistenceXmlDescriptor.validateAndReadFrom(LightPersistenceXmlDescriptor.java:55)
at io.quarkus.hibernate.orm.runtime.boot.QuarkusPersistenceUnitDefinition.
at io.quarkus.hibernate.orm.deployment.PersistenceUnitDescriptorBuildItem.asOutputPersistenceUnitDefinition(PersistenceUnitDescriptorBuildItem.java:55)
at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.build(HibernateOrmProcessor.java:361)
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$2.execute(ExtensionLoader.java:932)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
at io.quarkus.builder.Execution.run(Execution.java:115)
at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:149)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:251)
... 9 more
Caused by: java.lang.UnsupportedOperationException: Value found for #getJtaDataSource : not supported yet
at io.quarkus.hibernate.orm.runtime.boot.LightPersistenceXmlDescriptor.verifyIgnoredFields(LightPersistenceXmlDescriptor.java:164)
at io.quarkus.hibernate.orm.runtime.boot.LightPersistenceXmlDescriptor.validateAndReadFrom(LightPersistenceXmlDescriptor.java:55)
at io.quarkus.hibernate.orm.runtime.boot.QuarkusPersistenceUnitDefinition.
at io.quarkus.hibernate.orm.deployment.PersistenceUnitDescriptorBuildItem.asOutputPersistenceUnitDefinition(PersistenceUnitDescriptorBuildItem.java:55)
at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.build(HibernateOrmProcessor.java:361)
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$2.execute(ExtensionLoader.java:932)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
**Expected behavior**
The application should run and ignore the content frompersistence.xml` file according to this PR.
I should mention that if I run mvn test -Dtest=SomeTestCase -DSKIP_PARSE_PERSISTENCE_XML or java-jar *-runner.jar -DSKIP_PARSE_PERSISTENCE_XML it works well.
Actual behavior
The application is not started.
To Reproduce
Link to a small reproducer (preferably a Maven project if the issue is not Gradle-specific).
Or attach an archive containing the reproducer to the issue.
Steps to reproduce the behavior:
Configuration
# Add your application.properties here, if applicable.
Screenshots
(If applicable, add screenshots to help explain your problem.)
Environment (please complete the following information):
uname -a or ver: Microsoft Windows [Version 10.0.18363.1082]java -version: java version "1.8.0_201"mvnw --version or gradlew --version): Maven home: C:\Users\HR11MD.m2\wrapper\dists\apache-maven-3.6.3-bin\1iopthnavndlasol9gbrbg6bf2\apache-maven-3.6.3Additional context
(Add any other context about the problem here.)
Hi, the SKIP_PARSE_PERSISTENCE_XML is meant as an advanced, temporary solution - not a feature. That's why it's not documented and why it is modelled as a system property.
The fact that people seem to really want using it makes me think that perhaps it should become a configuration property - but I'd prefer to avoid it if possible.
Could you expand on why you want to use this, and why in development mode?
Thanks
Ok. I found it on the PR that I was talking about in the blog post. I'm trying to use it because I'm working on migrating an existing project from a JavaEE application deployed on JBoss to a Quarkus fat-jar app. Also, I can't use the current persistence.xml because it involves a JTA data source which is managed in the application by referencing it via JNDI. I prefer to keep the data source configurations into the application.properties.
The flag is working fine, but I must provide it like -DSKIP_PARSE_PERSISTENCE_XML=true only for the command mvn compile quarkus:dev, otherwise it is enough to use it without specifying the boolean value.
Ok, but why not deleting the persistence.xml file you have? It sems to me that this would be the first step in a migration: adapt to the new configuration files.
I forgot to mention that we should keep running for a while both versions of the app. :) My bad!
Ok, but why not deleting the
persistence.xmlfile you have? It sems to me that this would be the first step in a migration: adapt to the new configuration files.
I'm having the very same problem as author. I cannot delete persistence xml as it's an external library that uses and needs persistence.xml on Wildfly appserver.
Solution with running with -DSKIP_PARSE_PERSISTENCE_XML=true is fine for running, but I'm having problems while running tests from VS Code. I think that solution presented here (ability to add exclusion in application.properties): https://github.com/tisoft/quarkus/commit/ae7f5313f65ca77d7c5925d5655d0424037e3c0e#diff-91a0e430b5bed4242688294605aa58de166ce3f8b20d4d75d1e92fc8b423a88b would be nice.
@jgrabowski you can run the tests by using Maven. Or you can add a system property in your Run Configuration (at least this works in IntelliJ IDEA). I did not use VS Code and I don't know its features :)
It looks like a common issue so maybe we should add an option for it.
I don't think it would be that hard to be honest so maybe someone can give it a go?
We could add an ignore-persistence-xml option here: https://github.com/quarkusio/quarkus/blob/master/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmConfig.java and take it into account instead of throwing an error.
Ok. I tried hard to avoid the option, but you all managed to change my mind. Thanks!
I can give it a try.
Hi @gsmet,
having a look at the code I have a couple questions on this.
Given the documentation I would expect to have an exception raised when having set quarkus.hibernate-orm.* properties in application.properties file and persistence.xml is present at the same time. I suppose the documentation refers to this.https://github.com/quarkusio/quarkus/blob/4f17da34b56b87f740b927884aa385bac3333df5/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java#L642-L645 But I was not able to reproduce it.
To my understanding, in order to get this exception, handleHibernateORMWithNoPersistenceXml method should be fired according to this if statement https://github.com/quarkusio/quarkus/blob/4f17da34b56b87f740b927884aa385bac3333df5/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java#L305-L309
This if statement evaluates as true if this line https://github.com/quarkusio/quarkus/blob/4f17da34b56b87f740b927884aa385bac3333df5/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java#L267 has been executed which in case of having persistence.xml is never reached since we get an early exit in the ImpliedBlockingPersistenceUnitTypeBuildItem method at this point https://github.com/quarkusio/quarkus/blob/4f17da34b56b87f740b927884aa385bac3333df5/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java#L253-L257
Am I missing something on this? Does LaunchMode affect this flow?
Most helpful comment
I can give it a try.