open-telemetry / open-telemetry/opentelemetry-java-contrib
JMX Metrics: Protocol Error with otlp exporter
@SylvainJuge is already working on this.
Since Aug 4, 2025.
- Dominant language
- Java
- Stars
- 269
- Forks
- 196
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 38
Description
Description
I have a running tomcat server with a war file in it. The JMX port 9000 is open without authentication or TLS (only for testing).
There are many nice metrics in the console, if I do not define the exporter as otlp. So I assume the JMX connectivity works correctly.
But when I use the otlp exporter to send the metrics to my Elastic APM server, I get the following error:
May 23, 2022 10:32:59 PM io.opentelemetry.sdk.internal.ThrottlingLogger doLog
SEVERE: Failed to export metrics. The request could not be executed. Full error message: stream was reset: PROTOCOL_ERROR
May 23, 2022 10:33:04 PM io.opentelemetry.sdk.internal.ThrottlingLogger doLog
WARNING: Instrument jvm.classes.loaded has recorded multiple values for the same attributes.
I use the following command: java -jar opentelemetry-jmx-metrics.jar -config session.properties and the properties from below.
Steps to reproduce
At the moment it is an internal application and I have an on-premise Elasticsearch cluster. I will try to figure out how to give you a minimal working example.
Expectation
The metrics should be exportet to Elastic APM via the OpenTelemetry exporter.
What applicable config did you use?
My session.properties:
otel.jmx.service.url = service:jmx:rmi:///jndi/rmi://localhost:9000/jmxrmi
otel.jmx.target.system = jvm,tomcat
otel.jmx.interval.milliseconds = 5000
otel.metrics.exporter = otlp
otel.exporter.otlp.endpoint = https://MyElasticServer:8200
otel.exporter.otlp.headers = "Authorization=ApiKey MySecretKey"
otel.exporter.otlp.attributes = service.name=testapp,service.version=0.1,deployment.environment=dev
Relevant Environment Information
Version: 1.14.0
OS: Debian bullseye inside WSL2 on Windows10
Java: openjdk 11.0.15
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.