Issue in Quarkus native compilation due to Blazebit class
Hello
I am currently trying to build my application with Quarkus. The version I am using is 3.19.4 but it already happens with 3.16.2.
As part of the config, I have selected quarkus.datasource.db-kind as postgresql during the native compilation I get following exception. When instead I switch to quarkus.datasource.db-kind as h2 the build succeeds.
com.oracle.svm.core.util.VMError$HostedError: com.oracle.svm.core.util.UserError$UserException: Image heap writing found a class not seen during static analysis. Did a static field or an object referenced from a static field change during native image generation? For example, a lazily initialized cache could have been initialized during image generation, in which case you need to force eager initialization of the cache before static analysis or reset the cache using a field value recomputation.
class: org.hibernate.dialect.OracleUserDefinedTypeExporter
reachable through:
object: [Ljava.lang.Class;@2d66645f of class: java.lang.Class[]
object: com.oracle.svm.core.code.ImageCodeInfo@6c966463 of class: com.oracle.svm.core.code.ImageCodeInfo
root: com.oracle.svm.core.code.ImageCodeInfo.prepareCodeInfo()
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:82)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:720)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:550)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:539)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:721)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:143)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:98)
Caused by: com.oracle.svm.core.util.UserError$UserException: Image heap writing found a class not seen during static analysis. Did a static field or an object referenced from a static field change during native image generation? For example, a lazily initialized cache could have been initialized during image generation, in which case you need to force eager initialization of the cache before static analysis or reset the cache using a field value recomputation.
class: org.hibernate.dialect.OracleUserDefinedTypeExporter
reachable through:
object: [Ljava.lang.Class;@2d66645f of class: java.lang.Class[]
object: com.oracle.svm.core.code.ImageCodeInfo@6c966463 of class: com.oracle.svm.core.code.ImageCodeInfo
root: com.oracle.svm.core.code.ImageCodeInfo.prepareCodeInfo()
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.UserError.abort(UserError.java:73)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.reportIllegalType(NativeImageHeap.java:592)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.addConstant(NativeImageHeap.java:303)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.processAddObjectWorklist(NativeImageHeap.java:705)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.addTrailingObjects(NativeImageHeap.java:202)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.buildNativeImageHeap(NativeImageGenerator.java:760)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:697)
... 5 more
Please let me know if you need something extra from my side.
Regards
This is interesting. Do you encounter this issue with plain Hibernate ORM as well? The class causing the trouble seems to be a Hibernate ORM class and not one of Blaze-Persistence.
I'm also having the same issue, after removing the blaze-persistence related dependencies, the build succeeds.
This is the compilation result of my test project. https://github.com/heshang233/blaze-test/actions/runs/14699560142/job/41246559620
I tried your sample and noticed that the quarkus-blaze-persistence-bom refers to an old version of Blaze-Persistence. Upgrading to the latest version fixes the issue.
<dependency>
<groupId>com.blazebit</groupId>
<artifactId>blaze-persistence-entity-view-processor-jakarta</artifactId>
<version>1.6.16</version>
</dependency>
<dependency>
<groupId>com.blazebit</groupId>
<artifactId>blaze-persistence-integration-hibernate-6.2</artifactId>
<version>1.6.16</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.blazebit</groupId>
<artifactId>blaze-persistence-integration-quarkus-3-deployment</artifactId>
<version>1.6.16</version>
</dependency>
<dependency>
<groupId>com.blazebit</groupId>
<artifactId>blaze-persistence-integration-quarkus-3</artifactId>
<version>1.6.16</version>
</dependency>
Unfortunately, the version updates to the BOM are not backported, so you will probably have to override the version :(
Hi
I don't know what you changed. I guess the upgrade to Hibernate 7.1 made the trick. I am now able to build my Quarkus application with version 3.26.3 and Blaze 1.6.17.
Thanks and Regards