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 Javaagent failed to start #7401

Closed
devnewton opened this issue Dec 13, 2022 · 0 comments · Fixed by #7405
Closed

OpenTelemetry Javaagent failed to start #7401

devnewton opened this issue Dec 13, 2022 · 0 comments · Fixed by #7405
Labels
bug Something isn't working

Comments

@devnewton
Copy link

The opentelemetry java agent failed to start with the following exception:

[otel.javaagent 2022-12-13 10:27:53:164 +0000] [main] INFO io.opentelemetry.javaagent.tooling.VersionLogger - opentelemetry-javaagent - version: 1.20.2
[otel.javaagent 2022-12-13 10:27:55:000 +0000] [main] INFO io.opentelemetry.javaagent.shaded.instrumentation.jmx.engine.JmxMetricInsight - Empty JMX configuration, no metrics will be collected for InstrumentationScope io.opentelemetry.jmx
OpenTelemetry Javaagent failed to start
java.lang.NoClassDefFoundError: com/sun/management/GarbageCollectionNotificationInfo
	at io.opentelemetry.javaagent.shaded.instrumentation.runtimemetrics.GarbageCollector.registerObservers(GarbageCollector.java:48)
	at io.opentelemetry.javaagent.shaded.instrumentation.javaagent.runtimemetrics.RuntimeMetricsInstaller.afterAgent(RuntimeMetricsInstaller.java:41)
	at io.opentelemetry.javaagent.tooling.AgentInstaller.runAfterAgentListeners(AgentInstaller.java:263)
	at io.opentelemetry.javaagent.tooling.AgentInstaller.installBytebuddyAgent(AgentInstaller.java:181)
	at io.opentelemetry.javaagent.tooling.AgentInstaller.installBytebuddyAgent(AgentInstaller.java:94)
	at io.opentelemetry.javaagent.tooling.AgentStarterImpl.internalStart(AgentStarterImpl.java:86)
	at io.opentelemetry.javaagent.tooling.AgentStarterImpl.start(AgentStarterImpl.java:67)
	at io.opentelemetry.javaagent.bootstrap.AgentInitializer.initialize(AgentInitializer.java:35)
	at io.opentelemetry.javaagent.OpenTelemetryAgent.startAgent(OpenTelemetryAgent.java:57)
	at io.opentelemetry.javaagent.OpenTelemetryAgent.premain(OpenTelemetryAgent.java:45)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(Unknown Source)
	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.management.GarbageCollectionNotificationInfo
	at java.base/java.net.URLClassLoader.findClass(Unknown Source)
	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
	at io.opentelemetry.javaagent.bootstrap.AgentClassLoader.loadClass(AgentClassLoader.java:148)
	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)

I use this version from maven: io.opentelemetry.javaagent:opentelemetry-javaagent:1.20.2

java -javaagent:/opt/opentelemetry/opentelemetry-javaagent-1.20.2.jar -jar myapp.jar

Environment
Compiler: openjdk 17
OS: Linux
Build Docker image : maven:3-openjdk-17
Runtime Docker image : redhat/ubi9/ubi-minimal with a custom JRE built with jlink.

java.base,java.desktop,java.instrument,java.logging,java.management,java.naming,java.prefs,java.rmi,java.scripting,java.security.sasl,java.sql,java.sql.rowset,java.transaction.xa,java.xml,jdk.attach,jdk.httpserver,jdk.jdi,jdk.security.jgss,jdk.unsupported,jdk.crypto.ec \
         --strip-debug \
         --no-man-pages \
         --no-header-files \
         --compress=2 \
         --output /work/jre
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