Skip to content

NoClassDefFound when manually setting up JDBC instrumentation using a wrapped datasource #8461

@marcusrandevik

Description

@marcusrandevik

Describe the bug
Initializing JDBC instrumentation using the described metod at Datasource way causes the following error:

java.lang.NoClassDefFoundError: io/opentelemetry/api/internal/InstrumentationUtil

Steps to reproduce
Example project available here. Changing io.opentelemetry:opentelemetry-api from 1.62.0 to 1.63.0 causes the error to appear.

What did you expect to see?
No error, the class should be found and the connection should be instrumented.

What did you see instead?
A NoClassDefFoundError:

java.lang.NoClassDefFoundError: io/opentelemetry/api/internal/InstrumentationUtil
	at io.opentelemetry.instrumentation.api.instrumenter.SpanSuppressors$ByContextKey.shouldSuppress(SpanSuppressors.java:104)
	at io.opentelemetry.instrumentation.api.instrumenter.Instrumenter.shouldStart(Instrumenter.java:124)
	at io.opentelemetry.instrumentation.jdbc.internal.OpenTelemetryStatement.wrapCall(OpenTelemetryStatement.java:396)
	at io.opentelemetry.instrumentation.jdbc.internal.OpenTelemetryPreparedStatement.wrapCall(OpenTelemetryPreparedStatement.java:433)
	at io.opentelemetry.instrumentation.jdbc.internal.OpenTelemetryPreparedStatement.executeQuery(OpenTelemetryPreparedStatement.java:99)

What version and what artifacts are you using?
Artifacts: opentelemetry-api, opentelemetry-jdbc,
Version: 1.63.0, 2.28.1-alpha
How did you reference these artifacts?

implementation("io.opentelemetry:opentelemetry-api:1.63.0")
implementation("org.postgresql:postgresql:42.7.11")
implementation("io.opentelemetry.instrumentation:opentelemetry-jdbc:2.28.1-alpha")

Environment
Compiler: Corretto-21.0.5.11.1
OS: MacOS 26.5
Runtime: same as compiler
OS Same as above

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions