IllegalAccessError when using OpenTelemetry extension with custom Resource
See original GitHub issueDescribe the bug
I created a quarkus project with the OpenTelemetry extension and added a custom Resource CDI Producer
.
import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.SERVICE_INSTANCE_ID;
import java.util.UUID;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.sdk.resources.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ApplicationScoped
public class ResourceConfiguration {
private static final Logger log = LoggerFactory.getLogger(ResourceConfiguration.class);
@Produces
@ApplicationScoped
public Resource newRelicResource() {
log.info("Adding custom resources {}", ResourceConfiguration.class.getName());
return Resource.create(
Attributes.builder().put(SERVICE_INSTANCE_ID, UUID.randomUUID().toString()).build());
}
}
Expected behavior
The application should startup when ./mvnw clean quarkus:dev
Actual behavior
An exception is thrown
2022-01-11 16:39:21,512 DEBUG [org.hib.val.int.uti.Version] (Quarkus Main Thread) HV000001: Hibernate Validator 6.2.1.Final
2022-01-11 16:39:22,852 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile dev): java.lang.IllegalAccessError: class org.acme.otel.ResourceConfiguration_ProducerMethod_newRelicResource_625b8ffec6a326c4440bff06cc0a52e42734afec_ClientProxy tried to access method 'void io.opentelemetry.sdk.resources.Resource.<init>()' (org.acme.otel.ResourceConfiguration_ProducerMethod_newRelicResource_625b8ffec6a326c4440bff06cc0a52e42734afec_ClientProxy is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @cd7f1ae; io.opentelemetry.sdk.resources.Resource is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @76b10754)
at org.acme.otel.ResourceConfiguration_ProducerMethod_newRelicResource_625b8ffec6a326c4440bff06cc0a52e42734afec_ClientProxy.<init>(Unknown Source)
at org.acme.otel.ResourceConfiguration_ProducerMethod_newRelicResource_625b8ffec6a326c4440bff06cc0a52e42734afec_Bean.proxy(Unknown Source)
at org.acme.otel.ResourceConfiguration_ProducerMethod_newRelicResource_625b8ffec6a326c4440bff06cc0a52e42734afec_Bean.get(Unknown Source)
at org.acme.otel.ResourceConfiguration_ProducerMethod_newRelicResource_625b8ffec6a326c4440bff06cc0a52e42734afec_Bean.get(Unknown Source)
at io.quarkus.arc.impl.InstanceImpl.getBeanInstance(InstanceImpl.java:223)
at io.quarkus.arc.impl.InstanceImpl$InstanceIterator.next(InstanceImpl.java:259)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:657)
at io.quarkus.opentelemetry.runtime.tracing.TracerRecorder.setupResources(TracerRecorder.java:117)
at io.quarkus.deployment.steps.TracerProcessor$setupTracer558615094.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.TracerProcessor$setupTracer558615094.deploy(Unknown Source)
at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
at io.quarkus.runtime.Application.start(Application.java:101)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:104)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:67)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:41)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:120)
at io.quarkus.runner.GeneratedMain.main(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:103)
at java.base/java.lang.Thread.run(Thread.java:833)
2022-01-11 16:39:22,852 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile dev): java.lang.IllegalAccessError: class org.acme.otel.ResourceConfiguration_ProducerMethod_newRelicResource_625b8ffec6a326c4440bff06cc0a52e42734afec_ClientProxy tried to access method 'void io.opentelemetry.sdk.resources.Resource.<init>()' (org.acme.otel.ResourceConfiguration_ProducerMethod_newRelicResource_625b8ffec6a326c4440bff06cc0a52e42734afec_ClientProxy is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @cd7f1ae; io.opentelemetry.sdk.resources.Resource is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @76b10754)
at org.acme.otel.ResourceConfiguration_ProducerMethod_newRelicResource_625b8ffec6a326c4440bff06cc0a52e42734afec_ClientProxy.<init>(Unknown Source)
at org.acme.otel.ResourceConfiguration_ProducerMethod_newRelicResource_625b8ffec6a326c4440bff06cc0a52e42734afec_Bean.proxy(Unknown Source)
at org.acme.otel.ResourceConfiguration_ProducerMethod_newRelicResource_625b8ffec6a326c4440bff06cc0a52e42734afec_Bean.get(Unknown Source)
at org.acme.otel.ResourceConfiguration_ProducerMethod_newRelicResource_625b8ffec6a326c4440bff06cc0a52e42734afec_Bean.get(Unknown Source)
at io.quarkus.arc.impl.InstanceImpl.getBeanInstance(InstanceImpl.java:223)
at io.quarkus.arc.impl.InstanceImpl$InstanceIterator.next(InstanceImpl.java:259)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:657)
at io.quarkus.opentelemetry.runtime.tracing.TracerRecorder.setupResources(TracerRecorder.java:117)
at io.quarkus.deployment.steps.TracerProcessor$setupTracer558615094.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.TracerProcessor$setupTracer558615094.deploy(Unknown Source)
at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
at io.quarkus.runtime.Application.start(Application.java:101)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:104)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:67)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:41)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:120)
at io.quarkus.runner.GeneratedMain.main(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:103)
at java.base/java.lang.Thread.run(Thread.java:833)
2022-01-11 16:39:22,853 INFO [io.qua.dep.dev.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus startup failure
2022-01-11 16:39:22,853 INFO [io.qua.dep.dev.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus startup failure
2022-01-11 16:39:22,913 INFO [org.jbo.threads] (main) JBoss Threads version 3.4.2.Final
2022-01-11 16:39:23,002 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.dev.appstate.ApplicationStateNotification.waitForApplicationStart(ApplicationStateNotification.java:51)
at io.quarkus.runner.bootstrap.StartupActionImpl.runMainClass(StartupActionImpl.java:122)
at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:145)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:456)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:67)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:149)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:105)
at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:145)
at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:63)
Caused by: java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
at io.quarkus.runtime.Application.start(Application.java:101)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:104)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:67)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:41)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:120)
at io.quarkus.runner.GeneratedMain.main(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:103)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.IllegalAccessError: class org.acme.otel.ResourceConfiguration_ProducerMethod_newRelicResource_625b8ffec6a326c4440bff06cc0a52e42734afec_ClientProxy tried to access method 'void io.opentelemetry.sdk.resources.Resource.<init>()' (org.acme.otel.ResourceConfiguration_ProducerMethod_newRelicResource_625b8ffec6a326c4440bff06cc0a52e42734afec_ClientProxy is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @cd7f1ae; io.opentelemetry.sdk.resources.Resource is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @76b10754)
at org.acme.otel.ResourceConfiguration_ProducerMethod_newRelicResource_625b8ffec6a326c4440bff06cc0a52e42734afec_ClientProxy.<init>(Unknown Source)
at org.acme.otel.ResourceConfiguration_ProducerMethod_newRelicResource_625b8ffec6a326c4440bff06cc0a52e42734afec_Bean.proxy(Unknown Source)
at org.acme.otel.ResourceConfiguration_ProducerMethod_newRelicResource_625b8ffec6a326c4440bff06cc0a52e42734afec_Bean.get(Unknown Source)
at org.acme.otel.ResourceConfiguration_ProducerMethod_newRelicResource_625b8ffec6a326c4440bff06cc0a52e42734afec_Bean.get(Unknown Source)
at io.quarkus.arc.impl.InstanceImpl.getBeanInstance(InstanceImpl.java:223)
at io.quarkus.arc.impl.InstanceImpl$InstanceIterator.next(InstanceImpl.java:259)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:657)
at io.quarkus.opentelemetry.runtime.tracing.TracerRecorder.setupResources(TracerRecorder.java:117)
at io.quarkus.deployment.steps.TracerProcessor$setupTracer558615094.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.TracerProcessor$setupTracer558615094.deploy(Unknown Source)
... 13 more
How to Reproduce?
Output of uname -a
or ver
Linux usename 5.10.60.1-microsoft-standard-WSL2
Output of java -version
openjdk version “17.0.1” 2021-10-19 OpenJDK Runtime Environment (build 17.0.1+12-Ubuntu-120.04) OpenJDK 64-Bit Server VM (build 17.0.1+12-Ubuntu-120.04, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.6.1.Final
Build tool (ie. output of mvnw --version
or gradlew --version
)
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Maven home: Java version: 17.0.1, vendor: Private Build, runtime: /usr/lib/jvm/java-17-openjdk-amd64 Default locale: en, platform encoding: UTF-8 OS name: “linux”, version: “5.10.60.1-microsoft-standard-wsl2”, arch: “amd64”, family: “unix”
Additional information
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Error handling in OpenTelemetry
Custom handlers and filters can be registered both in code and using the Java logging configuration file. ## Turn off all error logging...
Read more >spring-cloud/spring-cloud-sleuth - Gitter
I'm looking at the migration docs, and if instrumentation-type=MANUAL , it says to use WebFluxSleuthOperators if I want to access the current Span,...
Read more >java.lang.IllegalAccessError: tried to access method
I was using a method of the abstract class from a web app. The weird thing is that I was able to deploy...
Read more >quarkusio/quarkus 2.7.2.Final on GitHub - NewReleases.io
... #22815 - IllegalAccessError when using OpenTelemetry extension with custom Resource; #22808 - Including resource bundles for different languages doesn't ...
Read more >chore(deps): update dependency io.quarkus:quarkus ... - GitLab
to be continuous... samples · maven-on-openshift · Merge requests !4. An error occurred while retrieving approval data for this merge request.
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
Yes, it’s problematic because the
io.opentelemetry.sdk.resources.Resource
obviously comes from a different package than theResourceConfiguration
producer. I think that we should try to make the constructorprotected
(ifquarkus.arc.transform-unproxyable-classes=true
). Let me try to prepare a PR.What is missing?