open-telemetry / open-telemetry/opentelemetry-java-contrib

JMX Metrics: Protocol Error with otlp exporter

Open
#351 1 comment 0 reactions 2 assignees View on GitHub

@SylvainJuge is already working on this.

Since Aug 4, 2025.

bug component:jmx-metrics
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.