CommunityToolkit / CommunityToolkit/Aspire
AddJavaApp does not configure certificate trust for the OTLP exporter
- Dominant language
- C#
- Stars
- 627
- Forks
- 196
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 35
Description
### Describe the bug
`AddJavaApp` and `AddJavaContainerApp` call `WithOtlpExporter()`, but never configure certificate trust. When the dashboard OTLP endpoint is served over HTTPS (Aspire's default), every export fails:
```
javax.net.ssl.SSLHandshakeException: (certificate_unknown) PKIX path building failed:
unable to find valid certification path to requested target
```
Aspire advertises its dev-cert PEM bundle via `SSL_CERT_DIR`/`SSL_CERT_FILE`, which the JVM ignores. The Python, JavaScript, Perl and McpInspector integrations all bridge this in a `WithCertificateTrustConfiguration` callback; the Java integration has no such call.
Setting `OTEL_EXPORTER_OTLP_CERTIFICATE` to `CertificateBundlePath` would fix telemetry export. (Not general outbound HTTPS — the JDK can't load a PEM bundle as a trust store.)
### Steps to reproduce
```text
var builder = DistributedApplication.CreateBuilder(args);
builder.AddJavaApp("backend", "../backend")
.WithMavenGoal("spring-boot:run");
builder.Build().Run();
```
1. Point the app at a Spring Boot service using `spring-boot-starter-opentelemetry` / `micrometer-registry-otlp`.
2. Run with the default `https` profile (do **not** set `ASPIRE_ALLOW_UNSECURED_TRANSPORT`).
### Expected behavior
Java resources export telemetry to the dashboard out of the box, without needing `ASPIRE_ALLOW_UNSECURED_TRANSPORT=true`, matching the Python, JavaScript, Perl and McpInspector integrations.
Contributor guide
Research direction
Start at the AddJavaApp and AddJavaContainerApp implementations and compare the certificate-trust callback used by the Python, JavaScript, Perl, and McpInspector integrations. Check how WithOtlpExporter uses CertificateBundlePath and verify that an HTTPS dashboard export succeeds without ASPIRE_ALLOW_UNSECURED_TRANSPORT; done means the PKIX error is gone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, java
- Domain
- observability-sre
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 75/100