Skip to content

@ServiceConnection for LgtmStackContainer fails when logging endpoint is configured due to multiple OtlpLoggingConnectionDetails beans #48536

@rajadilipkolli

Description

@rajadilipkolli

Issue : Multiple beans are created for OtlpLoggingConnectionDetails when both tracing and logging are enabled.

# Tracing Endpoint
management.opentelemetry.tracing.export.otlp.endpoint=http://localhost:4318/v1/traces
# Logs Exporter Endpoint
management.opentelemetry.logging.export.otlp.endpoint=http://localhost:4318/v1/logs

Problem : when OtlpLoggingConfigurations Autoconfiguration is triggered it is unable to create a bean as there is no unique bean that satisfies the 'org.springframework.boot.opentelemetry.autoconfigure.logging.otlp.OtlpLoggingConnectionDetails'

Below is the stacktrace

2025-12-15T22:22:36.799+05:30  INFO 20232 --- [boot-grafana-lgtm] [           main] [                                                 ] c.l.g.GrafanaLGTMApplicationTest         : Starting GrafanaLGTMApplicationTest using Java 25.0.1 with PID 20232 (started by 1039060 in C:\tools\git\my-spring-boot-experiments\boot-grafana-lgtm)
2025-12-15T22:22:36.803+05:30  INFO 20232 --- [boot-grafana-lgtm] [           main] [                                                 ] c.l.g.GrafanaLGTMApplicationTest         : No active profile set, falling back to 1 default profile: "default"
2025-12-15T22:22:38.416+05:30  INFO 20232 --- [boot-grafana-lgtm] [           main] [                                                 ] o.s.boot.tomcat.TomcatWebServer          : Tomcat initialized with port 0 (http)
2025-12-15T22:22:38.432+05:30  INFO 20232 --- [boot-grafana-lgtm] [           main] [                                                 ] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2025-12-15T22:22:38.433+05:30  INFO 20232 --- [boot-grafana-lgtm] [           main] [                                                 ] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/11.0.14]
2025-12-15T22:22:38.548+05:30  INFO 20232 --- [boot-grafana-lgtm] [           main] [                                                 ] b.w.c.s.WebApplicationContextInitializer : Root WebApplicationContext: initialization completed in 1487 ms
2025-12-15T22:22:38.651+05:30 ERROR 20232 --- [boot-grafana-lgtm] [           main] [                                                 ] t.s.DeferredServletContainerInitializers : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'webMvcObservationFilter' defined in class path resource [org/springframework/boot/webmvc/autoconfigure/WebMvcObservationAutoConfiguration.class]: Unsatisfied dependency expressed through method 'webMvcObservationFilter' parameter 0: Error creating bean with name 'observationRegistry' defined in class path resource [org/springframework/boot/micrometer/observation/autoconfigure/ObservationAutoConfiguration.class]: Error creating bean with name 'tracingObservationHandlerGroup' defined in class path resource [org/springframework/boot/micrometer/tracing/autoconfigure/MicrometerTracingAutoConfiguration.class]: Unsatisfied dependency expressed through method 'tracingObservationHandlerGroup' parameter 0: Error creating bean with name 'micrometerOtelTracer' defined in class path resource [org/springframework/boot/micrometer/tracing/opentelemetry/autoconfigure/OpenTelemetryTracingAutoConfiguration.class]: Unsatisfied dependency expressed through method 'micrometerOtelTracer' parameter 0: Error creating bean with name 'otelTracer' defined in class path resource [org/springframework/boot/micrometer/tracing/opentelemetry/autoconfigure/OpenTelemetryTracingAutoConfiguration.class]: Unsatisfied dependency expressed through method 'otelTracer' parameter 0: Error creating bean with name 'openTelemetrySdk' defined in class path resource [org/springframework/boot/opentelemetry/autoconfigure/OpenTelemetrySdkAutoConfiguration.class]: Failed to instantiate [io.opentelemetry.sdk.OpenTelemetrySdk]: Factory method 'openTelemetrySdk' threw exception with message: Error creating bean with name 'openTelemetrySdkLoggerProvider' defined in class path resource [org/springframework/boot/opentelemetry/autoconfigure/logging/OpenTelemetryLoggingAutoConfiguration.class]: Failed to instantiate [io.opentelemetry.sdk.logs.SdkLoggerProvider]: Factory method 'openTelemetrySdkLoggerProvider' threw exception with message: Error creating bean with name 'openTelemetryBatchLogRecordProcessor' defined in class path resource [org/springframework/boot/opentelemetry/autoconfigure/logging/OpenTelemetryLoggingAutoConfiguration.class]: Failed to instantiate [io.opentelemetry.sdk.logs.export.BatchLogRecordProcessor]: Factory method 'openTelemetryBatchLogRecordProcessor' threw exception with message: Error creating bean with name 'otlpHttpLogRecordExporter' defined in class path resource [org/springframework/boot/opentelemetry/autoconfigure/logging/otlp/OtlpLoggingConfigurations$Exporters.class]: Unsatisfied dependency expressed through method 'otlpHttpLogRecordExporter' parameter 1: No qualifying bean of type 'org.springframework.boot.opentelemetry.autoconfigure.logging.otlp.OtlpLoggingConnectionDetails' available: expected single matching bean but found 2: otlpLoggingContainerConnectionDetailsForLgtmContainer,openTelemetryLoggingConnectionDetails

Sample to reproduce the error , download and try to run GrafanaLGTMApplicationTest testcases or try to start the application using testcontainers in dev mode from TestGrafanaLGTMApplication class
boot-grafana-lgtm.zip

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions