Good day,
Base on Synchronous Kafka: Using Spring Request-Reply - DZone Big Data , I would like to try the Synchronous Kafka.
However, when I trying to creating the bean of ConsumerFactory
. I am hitting the java.lang.VerifyError: Bad return type
error.
My code is as follow:
import org.springframework.kafka.support.serializer.JsonDeserializer;
||// Default Consumer Factory|
|---|---|
||@Bean|
||public ConsumerFactory<String, JSONObject> consumerFactory() {|
|| return new DefaultKafkaConsumerFactory<>(producerConfigs(),new StringDeserializer(),new JsonDeserializer<>(JSONObject.class));|
||}|
In the gradle dependency, I can see its using com.fasterxml.jackson.core:jackson-databind:2.10.5.1
:
And the error in my eclipse console is as follow:
WFLYCTL0186: Services which failed to start: service jboss.undertow.deployment.default-server.default-host./eai: java.lang.RuntimeException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ReplyingKafkaTemplate' defined in com.beans.eai.config.WebConfig: Unsatisfied dependency expressed through method 'replyKafkaTemplate' parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'replyContainer' defined in com.beans.eai.config.WebConfig: Unsatisfied dependency expressed through method 'replyContainer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'consumerFactory' defined in com.beans.eai.config.WebConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.kafka.core.ConsumerFactory]: Factory method 'consumerFactory' threw exception; nested exception is java.lang.VerifyError: Bad return type
Exception Details:
Location:
com/fasterxml/jackson/databind/cfg/MapperBuilder.streamFactory()Lcom/fasterxml/jackson/core/TokenStreamFactory; @7: areturn
Reason:
Type 'com/fasterxml/jackson/core/JsonFactory' (current frame, stack[0]) is not assignable to 'com/fasterxml/jackson/core/TokenStreamFactory' (from method signature)
Current Frame:
bci: @7
flags: { }
locals: { 'com/fasterxml/jackson/databind/cfg/MapperBuilder' }
stack: { 'com/fasterxml/jackson/core/JsonFactory' }
Bytecode:
0x0000000: 2ab4 0002 b600 08b0
Is it I need to use another version of the library to handle this?