I am getting the following exception when running my application (with opentelemetry agent and my own custom exporter)
[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.
Here is the command line I am using to start my application 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
the jar -Dotel.exporter.jar=/path/to/mykafka-exporter-1.0-jar-with-dependencies.jar
is bundled with all dependencies including org.apache.kafka.common.serialization.ByteArraySerializer
here is the sample code from my own exporter.
exporter = new ZipkinSpanExporterBuilder()
.setSender(
KafkaSender.newBuilder()
.bootstrapServers(getKafkaBootstrapServers(config))
.topic(getKafkaTopic(config))
.encoding(Encoding.PROTO3)
.build())
.setEncoder(SpanBytesEncoder.PROTO3)
.build();
the program does load KafkaSender
class but not ByteArraySerializer
class. even though both are part of mykafka-exporter-1.0-jar-with-dependencies.jar
Note: the exporter does recognized and started, but when traces are exported to Kafka, this class load error pops up.
Thanks in advance.
question from:
https://stackoverflow.com/questions/65946487/bytearrayserializer-could-not-be-found 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…