zipkin-reporter-java
zipkin-reporter-java copied to clipboard
Class loading error: ByteArraySerializer could not be found when using KafkaSender.
I am getting this error when opentelemetry is trying to export traces to Kafka using Kafka sender.
[BatchSpanProcessor_WorkerThread-1] WARN io.opentelemetry.sdk.trace.export.BatchSpanProcessor$Worker - Exporter threw an Exception org.apache.kafka.common.config.ConfigException: Invalid value org.apache.kafka.common.serialization.ByteArraySerializer for configuration key.serializer: Class org.apache.kafka.common.serialization.ByteArraySerializer could not be found.
i am using -Dotel.exporter.jar=myexporter.jar option to use my own custom exporter . myexporter.java does contains the org.apache.kafka.common.serialization.StringSerializer. but when running th application getting this error
StackOverFlow Question: https://stackoverflow.com/questions/65946487/class-not-found-error-in-open-telemetry-exporter
Any help is highly appreciated. Thanks
Is this an issue in our end @anuraaga?
On Fri, 29 Jan 2021, 16:56 Maheswaran Krishnan, [email protected] wrote:
[BatchSpanProcessor_WorkerThread-1] WARN io.opentelemetry.sdk.trace.export.BatchSpanProcessor$Worker - Exporter threw an Exception org.apache.kafka.common.config.ConfigException: Invalid value org.apache.kafka.common.serialization.ByteArraySerializer for configuration key.serializer: Class org.apache.kafka.common.serialization.ByteArraySerializer could not be found.
i am using -Dotel.exporter.jar=myexporter.jar option to use my own custom exporter . myexporter.java does contains the org.apache.kafka.common.serialization.StringSerializer. but when running th application getting this error
StackOverFlow Question: https://stackoverflow.com/questions/65946487/class-not-found-error-in-open-telemetry-exporter
Any help is highly appreciated. Thanks
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/openzipkin/zipkin-reporter-java/issues/199, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXOYAWJFCIRNFYCG6ZD4YDS4LLCBANCNFSM4WZCQA4A .
Additional context
this is the command line I am using to start my server
java -javaagent:/path/to/opentelemetry-javaagent-all.jar \
-Dotel.exporter.jar=/path/to/mykafka-exporter-1.0-jar-with-dependencies.jar \
-Dotel.exporter.zipkin.service.name=sre-client-service-demo \
-Dotel.exporter.zipkin.kafka.bootstrap.servers=localhost:9092 \
-Dotel.exporter.zipkin.kafka.topic=myapp-sre \
-jar ./.out/libs/server.jar server config.yml
- this otel.exporter.jar=/path/to/mykafka-exporter-1.0-jar-with-dependencies.jar DOES contain the org.apache.kafka.common.serialization.ByteArraySerializer
- the agent boot loader DOES not have org.apache.kafka.common.serialization.ByteArraySerializer
- here is the code from Kafka which tries to dynamically loads ByteArraySerializer class using (Thread.currentThread().getContextClassLoader())
public static ClassLoader getContextOrKafkaClassLoader() {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null)
return getKafkaClassLoader();
else
return cl;
}
- Thread.currentThread().getContextClassLoader() is Bootstrap agent class loader which does not have ByteArraySerializer.
- if I change the line "ClassLoader cl = Thread.currentThread().getContextClassLoader();" to "ClassLoader cl = null" it works but Thread.currentThread().getContextClassLoader(); not supposed (in my opinion) to have bootstrap class loader it seems.
this is not the opentelemetry project, so if this is still an issue, raise it there. this project does not do any classloader related configuration