org.objectweb.asm.ClassTooLargeException when building a project with 2K+ Hibernate entities (hbm.xmls).
See original GitHub issueDescribe the bug
When we are trying to build our project with 2K+ Hibernate Entities (hbm.xmls) we are getting below exception.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 57.961 s
[INFO] Finished at: 2022-01-12T16:57:23+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:build (quarkus-final-build-before-package) on project dna-wireless-service: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.deployment.steps.MainClassBuildStep#build threw an exception: org.objectweb.asm.ClassTooLargeException: Class too large: io/quarkus/deployment/steps/HibernateOrmProcessor$build1373687952
[ERROR] at org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:599)
[ERROR] at io.quarkus.gizmo.ClassCreator.writeTo(ClassCreator.java:214)
[ERROR] at io.quarkus.gizmo.ClassCreator.close(ClassCreator.java:225)
[ERROR] at io.quarkus.deployment.recording.BytecodeRecorderImpl.writeBytecode(BytecodeRecorderImpl.java:595)
[ERROR] at io.quarkus.deployment.steps.MainClassBuildStep.writeRecordedBytecode(MainClassBuildStep.java:436)
[ERROR] at io.quarkus.deployment.steps.MainClassBuildStep.build(MainClassBuildStep.java:168)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[ERROR] at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:887)
[ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR] at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
[ERROR] at java.base/java.lang.Thread.run(Thread.java:829)
[ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Expected behavior
Build to go through successfully.
Actual behavior
Build failure.
How to Reproduce?
- Compile a project with large set of entities (2K+)
Output of uname -a
or ver
Linux ubuntu 4.15.0-159-generic #167-Ubuntu SMP Tue Sep 21 08:55:05 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Output of java -version
openjdk version “11.0.11” 2021-04-20 OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.18.04) OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.18.04, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.6.2.Final
Build tool (ie. output of mvnw --version
or gradlew --version
)
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Additional information
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
hibernate org.objectweb.asm.classwriter - java - Stack Overflow
for including hibernate entity manager i am using following code. <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate- ...
Read more >[Newbie Issue] hibernate.cfg.xml and hbm.xmls are not ...
Obviously, the hibernate.cfg.xml was not copied into the jar. ... <project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= ...
Read more >Mix JPA Annotation with Hibernate hbm.xml files... - JBoss.org
Hi, I have already a project based on SEAM and JPA Annotation. Now I want to extends the project with Hibernate mapping XML,...
Read more >Hibernate Tools Reference Guide - Red Hat on GitHub
Viewing the entity structure; 4.10.2. ... Creating JPA project with Hibernate support; 4.13.2. ... Generate mapping ( hbm.xml ) files for each entity....
Read more >How to generate Hibernate mapping files & annotation with ...
In this article, we show you how to use Hibernate / JBoss Tools to generate Hibernate mapping files (hbm) and annotation code from...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Note in this particular project, hbm.xml files are being used, which means we record POJOs representing the content of those XML files during the build. This may or may not be the reason for the class file being “too large”.
(One of the goals being to avoid XML parsing when the application starts, we cannot simply read the XML files again during static init).
https://github.com/quarkusio/quarkus/pull/22932 may help here, but I need to make some recorder improvements to fix this properly.