Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hibernate regression in Quarkus 3.17.2 org.hibernate.bytecode.enhance.spi.EnhancementException fails to build #44909

Closed
dhoffer opened this issue Dec 3, 2024 · 6 comments
Labels
area/hibernate-orm Hibernate ORM kind/bug Something isn't working triage/duplicate This issue or pull request already exists

Comments

@dhoffer
Copy link

dhoffer commented Dec 3, 2024

Describe the bug

Hibernate regression in Quarkus 3.17.2

We have an entity that implements one or more interfaces. Those interface methods don't always map to a field in the class but to another method. This has worked fine in all versions of Quarkus (Hibernate) through 3.16.4, error started when we upgraded to 3.17.2, I did not try 3.17.0.

[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:3.17.2:build (default) on project json-view-schema-example: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR] 	[error]: Build step io.quarkus.deployment.steps.ClassTransformingBuildStep#handleClassTransformation threw an exception: java.lang.reflect.UndeclaredThrowableException
[ERROR] 	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:862)
[ERROR] 	at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
[ERROR] 	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
[ERROR] 	at java.base/java.lang.Thread.run(Thread.java:1583)
[ERROR] 	at org.jboss.threads.JBossThread.run(JBossThread.java:499)
[ERROR] Caused by: java.util.concurrent.ExecutionException: org.hibernate.bytecode.enhance.spi.EnhancementException: Enhancement of [com.example.jsonview.model.Group] failed because no field named [x] could be found for property accessor method [getX]. To fix this, make sure all property accessor methods have a matching field.
[ERROR] 	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
[ERROR] 	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
[ERROR] 	at io.quarkus.deployment.steps.ClassTransformingBuildStep.handleClassTransformation(ClassTransformingBuildStep.java:273)
[ERROR] 	at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733)
[ERROR] 	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
[ERROR] 	... 8 more
[ERROR] Caused by: org.hibernate.bytecode.enhance.spi.EnhancementException: Enhancement of [com.example.jsonview.model.Group] failed because no field named [x] could be found for property accessor method [getX]. To fix this, make sure all property accessor methods have a matching field.
[ERROR] 	at org.hibernate.bytecode.enhance.internal.bytebuddy.EnhancerImpl.checkUnsupportedAttributeNaming(EnhancerImpl.java:497)
[ERROR] 	at org.hibernate.bytecode.enhance.internal.bytebuddy.EnhancerImpl.doEnhance(EnhancerImpl.java:178)
[ERROR] 	at org.hibernate.bytecode.enhance.internal.bytebuddy.EnhancerImpl.lambda$enhance$1(EnhancerImpl.java:120)
[ERROR] 	at org.hibernate.bytecode.internal.bytebuddy.ByteBuddyState.rewrite(ByteBuddyState.java:166)
[ERROR] 	at org.hibernate.bytecode.enhance.internal.bytebuddy.EnhancerImpl.enhance(EnhancerImpl.java:120)
[ERROR] 	at io.quarkus.hibernate.orm.deployment.HibernateEntityEnhancer$HibernateEnhancingClassVisitor.hibernateEnhancement(HibernateEntityEnhancer.java:83)
[ERROR] 	at io.quarkus.hibernate.orm.deployment.HibernateEntityEnhancer$HibernateEnhancingClassVisitor.visitEnd(HibernateEntityEnhancer.java:76)
[ERROR] 	at org.objectweb.asm.ClassVisitor.visitEnd(ClassVisitor.java:395)
[ERROR] 	at io.quarkus.panache.common.deployment.visitors.PanacheEntityClassAccessorGenerationVisitor.visitEnd(PanacheEntityClassAccessorGenerationVisitor.java:126)
[ERROR] 	at org.objectweb.asm.ClassVisitor.visitEnd(ClassVisitor.java:395)
[ERROR] 	at org.objectweb.asm.ClassReader.accept(ClassReader.java:749)
[ERROR] 	at org.objectweb.asm.ClassReader.accept(ClassReader.java:425)
[ERROR] 	at io.quarkus.deployment.steps.ClassTransformingBuildStep.transformClass(ClassTransformingBuildStep.java:367)
[ERROR] 	at io.quarkus.deployment.steps.ClassTransformingBuildStep$2.call(ClassTransformingBuildStep.java:238)
[ERROR] 	at io.quarkus.deployment.steps.ClassTransformingBuildStep$2.call(ClassTransformingBuildStep.java:225)
[ERROR] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[ERROR] 	... 7 more

Here is a reproducer app: json-view-schema-example.zip

Expected behavior

Build should be successful like it has been until using Quarkus 3.17.2.

Actual behavior

Build fails with org.hibernate.bytecode.enhance.spi.EnhancementException:

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

java 21.0.4 2024-07-16 LTS

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)

Additional information

No response

@dhoffer dhoffer added the kind/bug Something isn't working label Dec 3, 2024
@quarkus-bot quarkus-bot bot added the area/hibernate-orm Hibernate ORM label Dec 3, 2024
Copy link

quarkus-bot bot commented Dec 3, 2024

/cc @gsmet (hibernate-orm), @yrodiere (hibernate-orm)

@dhoffer
Copy link
Author

dhoffer commented Dec 3, 2024

I can confirm this bug is limited to Quarkus 3.17.2 only, which uses hibernate 6.6.3.Final.

Quarkus 3.17.0 which uses hibernate 6.6.1.Final does not have this bug.

@geoand
Copy link
Contributor

geoand commented Dec 4, 2024

I am wondering if #44863 is related

@mbladel
Copy link
Member

mbladel commented Dec 4, 2024

@geoand yes, this error is also triggered by the new check introduced by https://hibernate.atlassian.net/browse/HHH-16572, see my comment on the other issue for more details.

A possible workaround is annotating those methods with jakarta.persistence.Transient, or changing their name so they don't start with is, get or set.

I've added the link to the reproducer for this issue in the Hibernate issue I previously created, thank you @dhoffer for providing that and reporting the issue, we should address this case as well when refining the check.

@geoand
Copy link
Contributor

geoand commented Dec 4, 2024

🙏🏽

@yrodiere
Copy link
Member

yrodiere commented Dec 4, 2024

Thanks for reporting. Closing as duplicate of #44863 , let's follow progress there.

@yrodiere yrodiere closed this as not planned Won't fix, can't repro, duplicate, stale Dec 4, 2024
@yrodiere yrodiere added the triage/duplicate This issue or pull request already exists label Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hibernate-orm Hibernate ORM kind/bug Something isn't working triage/duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants