- Notifications
You must be signed in to change notification settings - Fork 916
Closed
Labels
BugSomething isn't workingSomething isn't working
Description
Describe the bug
When running an application that exclusively uses the module path, and places its own modules plus those of OpenTelemetry on the module path, I get errors like this:
cardant: WARN: io.opentelemetry.sdk.metrics.export.PeriodicMetricReader: Exporter threw an Exception java.lang.NoClassDefFoundError: Could not initialize class io.opentelemetry.exporter.internal.marshal.UnsafeString at io.opentelemetry.exporter.internal@1.44.1/io.opentelemetry.exporter.internal.marshal.StatelessMarshalerUtil.getUtf8Size(StatelessMarshalerUtil.java:308) at io.opentelemetry.exporter.internal@1.44.1/io.opentelemetry.exporter.internal.marshal.StatelessMarshalerUtil.getUtf8Size(StatelessMarshalerUtil.java:303) at io.opentelemetry.exporter.internal@1.44.1/io.opentelemetry.exporter.internal.marshal.StatelessMarshalerUtil.sizeStringWithContext(StatelessMarshalerUtil.java:98) at io.opentelemetry.exporter.internal.otlp@1.44.1/io.opentelemetry.exporter.internal.otlp.metrics.MetricStatelessMarshaler.getBinarySerializedSize(MetricStatelessMarshaler.java:202) at io.opentelemetry.exporter.internal.otlp@1.44.1/io.opentelemetry.exporter.internal.otlp.metrics.MetricStatelessMarshaler.getBinarySerializedSize(MetricStatelessMarshaler.java:28) at io.opentelemetry.exporter.internal@1.44.1/io.opentelemetry.exporter.internal.marshal.StatelessMarshalerUtil.sizeRepeatedMessageWithContext(StatelessMarshalerUtil.java:135) at io.opentelemetry.exporter.internal.otlp@1.44.1/io.opentelemetry.exporter.internal.otlp.metrics.InstrumentationScopeMetricsStatelessMarshaler.getBinarySerializedSize(InstrumentationScopeMetricsStatelessMarshaler.java:58) at io.opentelemetry.exporter.internal.otlp@1.44.1/io.opentelemetry.exporter.internal.otlp.metrics.InstrumentationScopeMetricsStatelessMarshaler.getBinarySerializedSize(InstrumentationScopeMetricsStatelessMarshaler.java:22) at io.opentelemetry.exporter.internal@1.44.1/io.opentelemetry.exporter.internal.marshal.StatelessMarshalerUtil$RepeatedElementPairSizeCalculator.accept(StatelessMarshalerUtil.java:263) at java.base/java.util.IdentityHashMap.forEach(Unknown Source) at io.opentelemetry.exporter.internal@1.44.1/io.opentelemetry.exporter.internal.marshal.StatelessMarshalerUtil.sizeRepeatedMessageWithContext(StatelessMarshalerUtil.java:188) at io.opentelemetry.exporter.internal.otlp@1.44.1/io.opentelemetry.exporter.internal.otlp.metrics.ResourceMetricsStatelessMarshaler.getBinarySerializedSize(ResourceMetricsStatelessMarshaler.java:70) at io.opentelemetry.exporter.internal.otlp@1.44.1/io.opentelemetry.exporter.internal.otlp.metrics.ResourceMetricsStatelessMarshaler.getBinarySerializedSize(ResourceMetricsStatelessMarshaler.java:28) at io.opentelemetry.exporter.internal@1.44.1/io.opentelemetry.exporter.internal.marshal.StatelessMarshalerUtil$RepeatedElementPairSizeCalculator.accept(StatelessMarshalerUtil.java:263) at java.base/java.util.IdentityHashMap.forEach(Unknown Source) at io.opentelemetry.exporter.internal@1.44.1/io.opentelemetry.exporter.internal.marshal.StatelessMarshalerUtil.sizeRepeatedMessageWithContext(StatelessMarshalerUtil.java:188) at io.opentelemetry.exporter.internal.otlp@1.44.1/io.opentelemetry.exporter.internal.otlp.metrics.LowAllocationMetricsRequestMarshaler.calculateSize(LowAllocationMetricsRequestMarshaler.java:84) at io.opentelemetry.exporter.internal.otlp@1.44.1/io.opentelemetry.exporter.internal.otlp.metrics.LowAllocationMetricsRequestMarshaler.initialize(LowAllocationMetricsRequestMarshaler.java:57) at io.opentelemetry.exporter.internal.otlp@1.44.1/io.opentelemetry.exporter.internal.otlp.metrics.MetricReusableDataMarshaler.export(MetricReusableDataMarshaler.java:45) at io.opentelemetry.exporter.otlp@1.44.1/io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporter.export(OtlpGrpcMetricExporter.java:107) at io.opentelemetry.sdk.metrics@1.44.1/io.opentelemetry.sdk.metrics.export.PeriodicMetricReader$Scheduled.doRun(PeriodicMetricReader.java:167) at io.opentelemetry.sdk.metrics@1.44.1/io.opentelemetry.sdk.metrics.export.PeriodicMetricReader$Scheduled.run(PeriodicMetricReader.java:153) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NoClassDefFoundError: sun/misc/Unsafe [in thread "PeriodicMetricReader-1"] at io.opentelemetry.exporter.internal@1.44.1/io.opentelemetry.exporter.internal.marshal.UnsafeAccess$UnsafeHolder.getUnsafe(UnsafeAccess.java:85) at io.opentelemetry.exporter.internal@1.44.1/io.opentelemetry.exporter.internal.marshal.UnsafeAccess$UnsafeHolder.<clinit>(UnsafeAccess.java:77) at io.opentelemetry.exporter.internal@1.44.1/io.opentelemetry.exporter.internal.marshal.UnsafeAccess.arrayBaseOffset(UnsafeAccess.java:64) at io.opentelemetry.exporter.internal@1.44.1/io.opentelemetry.exporter.internal.marshal.UnsafeString.<clinit>(UnsafeString.java:13) ... 28 common frames omitted Previously, I'd get a warning about a missing sun.misc.Unsafe class, but everything would still work correctly.
Steps to reproduce
It seems like placing the OpenTelemetry artifacts on the module path is enough to trigger this.
What did you expect to see?
No exceptions.
What did you see instead?
A rather nasty exception, and no telemetry being sent.
What version and what artifacts are you using?
1.44.1.
https://github.com/io7m-com/cardant/blob/db0178a55f80d2a5f729da6cb22af56ebdfa5a94/pom.xml#L530
Environment
openjdk version "23" 2024-09-17 OpenJDK Runtime Environment (build 23) OpenJDK 64-Bit Server VM (build 23, mixed mode, sharing) Metadata
Metadata
Assignees
Labels
BugSomething isn't workingSomething isn't working