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

opentelemetry native build not working when using oracle with hibernate #1697

Open
dcdh opened this issue Jan 28, 2025 · 3 comments
Open

opentelemetry native build not working when using oracle with hibernate #1697

dcdh opened this issue Jan 28, 2025 · 3 comments

Comments

@dcdh
Copy link
Member

dcdh commented Jan 28, 2025

Current behavior

I am using inside my application

        <dependency>
            <groupId>io.quarkiverse.cxf</groupId>
            <artifactId>quarkus-cxf-integration-tracing-opentelemetry</artifactId>
        </dependency>

to push my traces inside our APM.

I am using io.quarkus:quarkus-jdbc-oracle and io.quarkus:quarkus-hibernate-orm

When build in native mode it fails regarding the usage of com.sun.jmx.mbeanserver.JmxMBeanServer

Expected behavior

The native build should be ok and produce a native executable.

How to reproduce

  1. git clone quarkus-cxf
  2. checkout commit "[maven-release-plugin] prepare release 3.18.0"
  3. in integration-tests/opentelemetry update pom.xml by adding in maven dependencies:
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-jdbc-oracle</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-hibernate-orm</artifactId>
        </dependency>
  1. always inside integration-tests/opentelemetry do mvn clean install -Pnative -DskipTests -Dquarkus.native.container-build=true
[2/8] Performing analysis...  []                                                                        (34.0s @ 1.43GB)
   12,268 reachable types   (73.9% of   16,591 total)
   16,596 reachable fields  (37.9% of   43,785 total)
   49,601 reachable methods (36.1% of  137,579 total)
    5,061 types, 1,175 fields, and 7,470 methods registered for reflection

------------------------------------------------------------------------------------------------------------------------
Fatal error: org.graalvm.compiler.debug.GraalError: org.graalvm.compiler.debug.GraalError: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a MBean server in the image heap. This is currently not supported, but could be changed in the future. Management beans are registered in many global caches that would need to be cleared and properly re-built at image build time. Class of disallowed object: com.sun.jmx.mbeanserver.JmxMBeanServer If these objects should not be stored in the image heap, you can use

    '--trace-object-instantiation=com.sun.jmx.mbeanserver.JmxMBeanServer'

to find classes that instantiate these objects. Once you found such a class, you can mark it explicitly for run time initialization with

    '--initialize-at-run-time=<culprit>'

to prevent the instantiation of the object.
The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.setException(AnalysisFuture.java:49)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:322)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:63)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapInstance.readFieldValue(ImageHeapInstance.java:110)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.onObjectReachable(ImageHeapScanner.java:472)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.heap.SVMImageHeapScanner.onObjectReachable(SVMImageHeapScanner.java:156)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$markReachable$5(ImageHeapScanner.java:452)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$postTask$14(ImageHeapScanner.java:695)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:187)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:171)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
Caused by: org.graalvm.compiler.debug.GraalError: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a MBean server in the image heap. This is currently not supported, but could be changed in the future. Management beans are registered in many global caches that would need to be cleared and properly re-built at image build time. Class of disallowed object: com.sun.jmx.mbeanserver.JmxMBeanServer If these objects should not be stored in the image heap, you can use

    '--trace-object-instantiation=com.sun.jmx.mbeanserver.JmxMBeanServer'

to find classes that instantiate these objects. Once you found such a class, you can mark it explicitly for run time initialization with

    '--initialize-at-run-time=<culprit>'

to prevent the instantiation of the object.
The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.setException(AnalysisFuture.java:49)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:322)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:63)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.getOrCreateImageHeapConstant(ImageHeapScanner.java:212)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.heap.SVMImageHeapScanner.getOrCreateImageHeapConstant(SVMImageHeapScanner.java:109)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.createImageHeapConstant(ImageHeapScanner.java:186)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.createFieldValue(ImageHeapScanner.java:364)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$createImageHeapInstance$4(ImageHeapScanner.java:294)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        ... 14 more
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a MBean server in the image heap. This is currently not supported, but could be changed in the future. Management beans are registered in many global caches that would need to be cleared and properly re-built at image build time. Class of disallowed object: com.sun.jmx.mbeanserver.JmxMBeanServer If these objects should not be stored in the image heap, you can use

    '--trace-object-instantiation=com.sun.jmx.mbeanserver.JmxMBeanServer'

to find classes that instantiate these objects. Once you found such a class, you can mark it explicitly for run time initialization with

    '--initialize-at-run-time=<culprit>'

to prevent the instantiation of the object.
The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.DisallowedImageHeapObjectFeature.error(DisallowedImageHeapObjectFeature.java:174)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.DisallowedImageHeapObjectFeature.checkDisallowedMBeanObjects(DisallowedImageHeapObjectFeature.java:157)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.DisallowedImageHeapObjectFeature.replacer(DisallowedImageHeapObjectFeature.java:120)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.replaceObject(AnalysisUniverse.java:616)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.replaceObject(AnalysisConstantReflectionProvider.java:307)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.readArrayElement(AnalysisConstantReflectionProvider.java:158)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.createImageHeapObjectArray(ImageHeapScanner.java:267)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.createImageHeapObject(ImageHeapScanner.java:251)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$getOrCreateImageHeapConstant$2(ImageHeapScanner.java:205)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        ... 21 more
                        6.1s (8.3% of total time) in 143 GCs | Peak RSS: 2.77GB | CPU load: 3.42
========================================================================================================================
Finished generating 'quarkus-cxf-integration-test-opentelemetry-3.18.0-runner' in 1m 8s.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

with this property

quarkus.native.additional-build-args = --trace-object-instantiation=com.sun.jmx.mbeanserver.JmxMBeanServer

I obtain

[2/8] Performing analysis...  []                                                                        (27.7s @ 1.34GB)
    9,217 reachable types   (69.5% of   13,269 total)
   10,737 reachable fields  (33.3% of   32,238 total)
   34,514 reachable methods (33.3% of  103,711 total)
    4,107 types, 1,196 fields, and 7,153 methods registered for reflection

Fatal error: org.graalvm.compiler.debug.GraalError: org.graalvm.compiler.debug.GraalError: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a MBean server in the image heap. This is current
ly not supported, but could be changed in the future. Management beans are registered in many global caches that would need to be cleared and properly re-built at image build time. Class of disallowed object: com.sun.jmx.mbeanserver.JmxMBeanServer Try to avoid initializing the class that stores a MBean server or a MBean in a static field
The culprit object has been instantiated by the 'oracle.jdbc.driver.OracleDriver' class initializer with the following trace:
        at com.sun.jmx.mbeanserver.JmxMBeanServer.<init>(JmxMBeanServer.java:225)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.newMBeanServer(JmxMBeanServer.java:1437)
        at javax.management.MBeanServerBuilder.newMBeanServer(MBeanServerBuilder.java:110)
        at javax.management.MBeanServerFactory.newMBeanServer(MBeanServerFactory.java:329)
        at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:231)
        at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:192)
        at java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:487)
        at oracle.jdbc.driver.OracleDriver.registerMBeans(OracleDriver.java:493)
        at oracle.jdbc.driver.OracleDriver$1.run(OracleDriver.java:296)
        at java.security.AccessController.executePrivileged(AccessController.java:778)
        at java.security.AccessController.doPrivileged(AccessController.java:319)
        at oracle.jdbc.driver.OracleDriver.<clinit>(OracleDriver.java:294)
The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
------------------------------------------------------------------------------------------------------------------------
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.setException(AnalysisFuture.java:49)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:322)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:63)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapInstance.readFieldValue(ImageHeapInstance.java:110)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.onObjectReachable(ImageHeapScanner.java:472)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.heap.SVMImageHeapScanner.onObjectReachable(SVMImageHeapScanner.java:156)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$markReachable$5(ImageHeapScanner.java:452)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$postTask$14(ImageHeapScanner.java:695)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:187)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:171)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
Caused by: org.graalvm.compiler.debug.GraalError: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a MBean server in the image heap. This is currently not supported, but could be changed in
 the future. Management beans are registered in many global caches that would need to be cleared and properly re-built at image build time. Class of disallowed object: com.sun.jmx.mbeanserver.JmxMBeanServer Try to avoid initializing the class that stores a MBean server or a MBean in a static field
The culprit object has been instantiated by the 'oracle.jdbc.driver.OracleDriver' class initializer with the following trace:
        at com.sun.jmx.mbeanserver.JmxMBeanServer.<init>(JmxMBeanServer.java:225)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.newMBeanServer(JmxMBeanServer.java:1437)
        at javax.management.MBeanServerBuilder.newMBeanServer(MBeanServerBuilder.java:110)
        at javax.management.MBeanServerFactory.newMBeanServer(MBeanServerFactory.java:329)
        at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:231)
        at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:192)
        at java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:487)
        at oracle.jdbc.driver.OracleDriver.registerMBeans(OracleDriver.java:493)
        at oracle.jdbc.driver.OracleDriver$1.run(OracleDriver.java:296)
        at java.security.AccessController.executePrivileged(AccessController.java:778)
        at java.security.AccessController.doPrivileged(AccessController.java:319)
        at oracle.jdbc.driver.OracleDriver.<clinit>(OracleDriver.java:294)
The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.setException(AnalysisFuture.java:49)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:322)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:63)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.getOrCreateImageHeapConstant(ImageHeapScanner.java:212)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.heap.SVMImageHeapScanner.getOrCreateImageHeapConstant(SVMImageHeapScanner.java:109)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.createImageHeapConstant(ImageHeapScanner.java:186)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.createFieldValue(ImageHeapScanner.java:364)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$createImageHeapInstance$4(ImageHeapScanner.java:294)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        ... 14 more
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a MBean server in the image heap. This is currently not supported, but could be changed in the future. Management beans are regis
tered in many global caches that would need to be cleared and properly re-built at image build time. Class of disallowed object: com.sun.jmx.mbeanserver.JmxMBeanServer Try to avoid initializing the class that stores a MBean server or a MBean in a static field
The culprit object has been instantiated by the 'oracle.jdbc.driver.OracleDriver' class initializer with the following trace:
        at com.sun.jmx.mbeanserver.JmxMBeanServer.<init>(JmxMBeanServer.java:225)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.newMBeanServer(JmxMBeanServer.java:1437)
        at javax.management.MBeanServerBuilder.newMBeanServer(MBeanServerBuilder.java:110)
        at javax.management.MBeanServerFactory.newMBeanServer(MBeanServerFactory.java:329)
        at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:231)
        at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:192)
        at java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:487)
        at oracle.jdbc.driver.OracleDriver.registerMBeans(OracleDriver.java:493)
        at oracle.jdbc.driver.OracleDriver$1.run(OracleDriver.java:296)
        at java.security.AccessController.executePrivileged(AccessController.java:778)
        at java.security.AccessController.doPrivileged(AccessController.java:319)
        at oracle.jdbc.driver.OracleDriver.<clinit>(OracleDriver.java:294)
The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.DisallowedImageHeapObjectFeature.error(DisallowedImageHeapObjectFeature.java:174)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.DisallowedImageHeapObjectFeature.checkDisallowedMBeanObjects(DisallowedImageHeapObjectFeature.java:157)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.DisallowedImageHeapObjectFeature.replacer(DisallowedImageHeapObjectFeature.java:120)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.replaceObject(AnalysisUniverse.java:616)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.replaceObject(AnalysisConstantReflectionProvider.java:307)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.readArrayElement(AnalysisConstantReflectionProvider.java:158)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.createImageHeapObjectArray(ImageHeapScanner.java:267)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.createImageHeapObject(ImageHeapScanner.java:251)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$getOrCreateImageHeapConstant$2(ImageHeapScanner.java:205)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        ... 21 more
                        4.7s (7.3% of total time) in 148 GCs | Peak RSS: 2.14GB | CPU load: 3.48
@dcdh
Copy link
Member Author

dcdh commented Jan 28, 2025

@dcdh
Copy link
Member Author

dcdh commented Jan 28, 2025

@Sanne have you got some insight about it ?

@dcdh
Copy link
Member Author

dcdh commented Jan 28, 2025

I tri to reproduce it inside the integration-tests\client by adding oracle and hibernate. The step 2/8 of the build has passed. So I confirm that the issue is related to quarkus-cxf-integration-tracing-opentelemetry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant