opentelemetry-java
opentelemetry-java copied to clipboard
GraalVM buid: java.lang.NoSuchFieldException: producerIndex
Describe the bug I have tried to build a Micronaut application that uses OpenTelemetry with the GraalVM native image feature. Can build it successfully, but am unable to start the application, getting this error:
Caused by: java.lang.ExceptionInInitializerError: null
at java.lang.Class.ensureInitialized(DynamicHub.java:518)
at java.lang.Class.ensureInitialized(DynamicHub.java:518)
at java.lang.Class.ensureInitialized(DynamicHub.java:518)
at java.lang.Class.ensureInitialized(DynamicHub.java:518)
at java.lang.Class.ensureInitialized(DynamicHub.java:518)
at java.lang.Class.ensureInitialized(DynamicHub.java:518)
at io.opentelemetry.sdk.trace.internal.JcTools.newFixedSizeQueue(JcTools.java:26)
at io.opentelemetry.sdk.trace.export.BatchSpanProcessor.<init>(BatchSpanProcessor.java:80)
at io.opentelemetry.sdk.trace.export.BatchSpanProcessorBuilder.build(BatchSpanProcessorBuilder.java:147)
at com.tailrocks.user.api.config.OpenTelemetryConfig.otelSpanProcessor(OpenTelemetryConfig.java:45)
at com.tailrocks.user.api.config.$OpenTelemetryConfig$OtelSpanProcessor1$Definition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2336)
... 30 common frames omitted
Caused by: java.lang.RuntimeException: java.lang.NoSuchFieldException: producerIndex
at io.opentelemetry.internal.shaded.jctools.util.UnsafeAccess.fieldOffset(UnsafeAccess.java:111)
at io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueProducerIndexField.<clinit>(MpscArrayQueue.java:48)
... 42 common frames omitted
Caused by: java.lang.NoSuchFieldException: producerIndex
at java.lang.Class.getDeclaredField(DynamicHub.java:953)
at io.opentelemetry.internal.shaded.jctools.util.UnsafeAccess.fieldOffset(UnsafeAccess.java:107)
... 43 common frames omitted
What version and what artifacts are you using?
Artifacts: opentelemetry-sdk-trace
Version: 1.13.0
Environment Compiler: openjdk 17.0.3 GraalVM CE 22.1.0 (build 17.0.3+7-jvmci-22.1-b06) OS: macOS Monterey 12.3.1 (Apple M1)
hey @donbeave! my (probably poor) recollection is that you may need to provide some options to the native image compilation process to tell it about some types of reflective access which it cannot auto-detect