"NoClassDefFoundError: javax/ws/rs/core/UriBuilder" when running the demo runner
lawcha opened this issue · comments
I followed the Getting Started tutorial to run the first example YAML, but I get the following error when executing the run.sh
file.
2022-04-26T14:03:09,753Z [system] [pool-4-thread-1] INFO i.a.k.r.backend.kafka.KafkaBackend -
Starting Kafka Backend
2022-04-26T14:03:10,053Z [system] [io.ksml.example.processor-00d39059-38f3-4371-b2f6-09c570d8005d-StreamThread-1] ERROR o.apache.kafka.streams.KafkaStreams -
stream-client [io.ksml.example.processor-00d39059-38f3-4371-b2f6-09c570d8005d] Encountered the following exception during processing and the registered exception handler opted to SHUTDOWN_CLIENT. The streams client is going to shut down now.
java.lang.NoClassDefFoundError: javax/ws/rs/core/UriBuilder
at io.confluent.kafka.schemaregistry.client.rest.RestService.getId(RestService.java:656)
at io.confluent.kafka.schemaregistry.client.rest.RestService.getId(RestService.java:642)
at io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.getSchemaByIdFromRegistry(CachedSchemaRegistryClient.java:217)
at io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.getSchemaBySubjectAndId(CachedSchemaRegistryClient.java:291)
at io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.getSchemaById(CachedSchemaRegistryClient.java:276)
at io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer$DeserializationContext.schemaFromRegistry(AbstractKafkaAvroDeserializer.java:273)
at io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer.deserialize(AbstractKafkaAvroDeserializer.java:97)
at io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer.deserialize(AbstractKafkaAvroDeserializer.java:76)
at io.confluent.kafka.serializers.KafkaAvroDeserializer.deserialize(KafkaAvroDeserializer.java:55)
at io.axual.ksml.notation.AvroNotation$AvroSerde$2.deserialize(AvroNotation.java:77)
at org.apache.kafka.common.serialization.Deserializer.deserialize(Deserializer.java:60)
at org.apache.kafka.streams.processor.internals.SourceNode.deserializeValue(SourceNode.java:58)
at org.apache.kafka.streams.processor.internals.RecordDeserializer.deserialize(RecordDeserializer.java:66)
at org.apache.kafka.streams.processor.internals.RecordQueue.updateHead(RecordQueue.java:176)
at org.apache.kafka.streams.processor.internals.RecordQueue.addRawRecords(RecordQueue.java:112)
at org.apache.kafka.streams.processor.internals.PartitionGroup.addRawRecords(PartitionGroup.java:185)
at org.apache.kafka.streams.processor.internals.StreamTask.addRecords(StreamTask.java:957)
at org.apache.kafka.streams.processor.internals.TaskManager.addRecordsToTasks(TaskManager.java:1009)
at org.apache.kafka.streams.processor.internals.StreamThread.pollPhase(StreamThread.java:907)
at org.apache.kafka.streams.processor.internals.StreamThread.runOnce(StreamThread.java:720)
at org.apache.kafka.streams.processor.internals.StreamThread.runLoop(StreamThread.java:583)
at org.apache.kafka.streams.processor.internals.StreamThread.run(StreamThread.java:556)
Caused by: java.lang.ClassNotFoundException: javax.ws.rs.core.UriBuilder
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 22 common frames omitted
2022-04-26T14:03:10,053Z [system] [io.ksml.example.processor-00d39059-38f3-4371-b2f6-09c570d8005d-StreamThread-1] ERROR o.apache.kafka.streams.KafkaStreams -
stream-client [io.ksml.example.processor-00d39059-38f3-4371-b2f6-09c570d8005d] Encountered the following exception during processing and the registered exception handler opted to SHUTDOWN_CLIENT. The streams client is going to shut down now.
java.lang.NoClassDefFoundError: javax/ws/rs/core/UriBuilder
at io.confluent.kafka.schemaregistry.client.rest.RestService.getId(RestService.java:656)
at io.confluent.kafka.schemaregistry.client.rest.RestService.getId(RestService.java:642)
at io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.getSchemaByIdFromRegistry(CachedSchemaRegistryClient.java:217)
at io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.getSchemaBySubjectAndId(CachedSchemaRegistryClient.java:291)
at io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.getSchemaById(CachedSchemaRegistryClient.java:276)
at io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer$DeserializationContext.schemaFromRegistry(AbstractKafkaAvroDeserializer.java:273)
at io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer.deserialize(AbstractKafkaAvroDeserializer.java:97)
at io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer.deserialize(AbstractKafkaAvroDeserializer.java:76)
at io.confluent.kafka.serializers.KafkaAvroDeserializer.deserialize(KafkaAvroDeserializer.java:55)
at io.axual.ksml.notation.AvroNotation$AvroSerde$2.deserialize(AvroNotation.java:77)
at org.apache.kafka.common.serialization.Deserializer.deserialize(Deserializer.java:60)
at org.apache.kafka.streams.processor.internals.SourceNode.deserializeValue(SourceNode.java:58)
at org.apache.kafka.streams.processor.internals.RecordDeserializer.deserialize(RecordDeserializer.java:66)
at org.apache.kafka.streams.processor.internals.RecordQueue.updateHead(RecordQueue.java:176)
at org.apache.kafka.streams.processor.internals.RecordQueue.addRawRecords(RecordQueue.java:112)
at org.apache.kafka.streams.processor.internals.PartitionGroup.addRawRecords(PartitionGroup.java:185)
at org.apache.kafka.streams.processor.internals.StreamTask.addRecords(StreamTask.java:957)
at org.apache.kafka.streams.processor.internals.TaskManager.addRecordsToTasks(TaskManager.java:1009)
at org.apache.kafka.streams.processor.internals.StreamThread.pollPhase(StreamThread.java:907)
at org.apache.kafka.streams.processor.internals.StreamThread.runOnce(StreamThread.java:720)
at org.apache.kafka.streams.processor.internals.StreamThread.runLoop(StreamThread.java:583)
at org.apache.kafka.streams.processor.internals.StreamThread.run(StreamThread.java:556)
Caused by: java.lang.ClassNotFoundException: javax.ws.rs.core.UriBuilder
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 22 common frames omitted
2022-04-26T14:03:10,773Z [system] [pool-4-thread-1] INFO i.a.k.r.backend.kafka.KafkaBackend -
Streams implementation has stopped, stopping Kafka Backend
Environment
- Running on the WSL2 (Ubuntu) of Windows 10.
- Same behaviour on Java 11 or 1.8
Problem
The problem should come from the runner, as the logs of the producer seem good according to the Getting started.
Thank you for your help
Hi Laurent, I think the root cause is that module ksml-query has a dependency on jakarta.ws.rs-api:3.0.0 and module ksml depends on the Confluent schema registry client which transitively depends on jakarta.ws.rs-api:2.1.6. Maven tries to resolve the conflict and in the runtime image only the 3.0.0 version is present.
Unfortunately the package naming between the versions is slightly different and what is called javax.ws.rs.core.UriBuilder in 2.1.6 is called jakarta.ws.rs.core.UriBuilder in 3.0.0. (This is apparently due to some trademark discussion between the Eclipse foundation and Oracle).
To resolve either module ksml-query will have to be downgraded to use ws 2.1.6, or module ksml needs to be made to work with ws 3.0.0 (probably by upgrading the registry cient dependency). I've tried the former but did not manage to get it to build. (See also comment thread in #35 )
Hi,
Okay, I see. Thank you for the explanation. Hopefully, I am not in a hurry to use KSML in my project. I am looking forward to an update.
Does version 0.0.3 of KSML works well? I would like to try to understand how the given examples work until the current bug is solved.