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

java.lang.NoClassDefFoundError: java/beans/IntrospectionException if java.desktop not included #7580

Closed
bcmedeiros opened this issue Jan 16, 2023 · 1 comment · Fixed by #7598
Labels
bug Something isn't working

Comments

@bcmedeiros
Copy link

Describe the bug
In version 1.21.0 (this was probably introduced earlier than that), the agent is failing to initialize in the absence of the java.desktop module if you use a JDK built with jlink that does not include this module.

Steps to reproduce

  1. Create a custom JDK distribution using jlink and do not include the java.desktop module.
  2. Try to initialize the otel agent

What did you expect to see?
Initialization works successfully.

What did you see instead?
Initialization crashes with the following exception:

OpenTelemetry Javaagent failed to start
java.lang.NoClassDefFoundError: java/beans/IntrospectionException
    at org.yaml.snakeyaml.constructor.BaseConstructor.getPropertyUtils(BaseConstructor.java:645)
    at org.yaml.snakeyaml.constructor.BaseConstructor.addTypeDescription(BaseConstructor.java:664)
    at org.yaml.snakeyaml.constructor.Constructor.<init>(Constructor.java:134)
    at org.yaml.snakeyaml.constructor.Constructor.<init>(Constructor.java:79)
    at org.yaml.snakeyaml.constructor.Constructor.<init>(Constructor.java:60)
    at org.yaml.snakeyaml.Yaml.<init>(Yaml.java:64)
    at io.opentelemetry.instrumentation.spring.resources.SpringBootServiceNameDetector.parseNameFromYaml(SpringBootServiceNameDetector.java:178)
    at io.opentelemetry.instrumentation.spring.resources.SpringBootServiceNameDetector.loadFromClasspath(SpringBootServiceNameDetector.java:259)
    at io.opentelemetry.instrumentation.spring.resources.SpringBootServiceNameDetector.findByClasspathApplicationYaml(SpringBootServiceNameDetector.java:158)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
    at java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
    at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
    at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
    at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
    at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
    at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
    at java.base/java.util.stream.ReferencePipeline.findFirst(Unknown Source)
    at io.opentelemetry.instrumentation.spring.resources.SpringBootServiceNameDetector.createResource(SpringBootServiceNameDetector.java:92)
    at io.opentelemetry.sdk.autoconfigure.ResourceConfiguration.configureResource(ResourceConfiguration.java:59)

What version are you using?
1.21.0+ (might have been introduced before that)

Environment
Compiler: (e.g., "Adoptium 11.0.7")
OS: (e.g., "Alpine Linux")

@bcmedeiros bcmedeiros added the bug Something isn't working label Jan 16, 2023
@bcmedeiros
Copy link
Author

If you don't care about Spring, there is a workaround, just initialize the agent with:

-Dotel.java.disabled.resource.providers=io.opentelemetry.instrumentation.spring.resources.SpringBootServiceNameDetector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant