Reputation: 532
We are currently trying to make a SCS application that produces certain messages to a topic, however while running the application we come across the error:
The following method did not exist:
org.springframework.kafka.core.DefaultKafkaProducerFactory.setBeanName(Ljava/lang/String;)V
The method's class, org.springframework.kafka.core.DefaultKafkaProducerFactory, is available from the following locations:
jar:file:/C:/Users/Me/.gradle/caches/modules-2/files-2.1/org.springframework.kafka/spring-kafka/2.3.4.RELEASE/65f92192fc57991d4b135c715be5a506b3153ea1/spring-kafka-2.3.4.RELEASE.jar!/org/springframework/kafka/core/DefaultKafkaProducerFactory.class
It was loaded from the following location:
file:/C:/Users/Me/.gradle/caches/modules-2/files-2.1/org.springframework.kafka/spring-kafka/2.3.4.RELEASE/65f92192fc57991d4b135c715be5a506b3153ea1/spring-kafka-2.3.4.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.kafka.core.DefaultKafkaProducerFactory
We think there is a compatibility issue with spring-boot and the SCS. We are using spring-boot version: 2.2.2-RELEASE He have changed our version of SCS to Hoxton 2 and back to Hoxton 6, also tried changing our spring-kafka versioning so it contains the method setBeanName. When changing the spring-kafka version we ran into a similar error with a different method. Here are my gradle dependencies:
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-stream'
implementation 'org.springframework.cloud:spring-cloud-stream-binder-kafka'
implementation 'org.springframework.kafka:spring-kafka'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml'
Here is dependency management:
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
The issue (we think) is that spring-kafka is getting pulled in from somewhere else and is defaulting to the 2.3.4.RELEASE which doesn't contain the setBeanName.
Any thoughts on this?
Upvotes: 1
Views: 2713
Reputation: 532
We were able to alleviate our problem by switching to Spring Boot 2.3.1.RELEASE
Upvotes: 0
Reputation: 5904
You need to update the spring-kafka dependency to 2.3.10.BUILD-SNAPSHOT
in the application to solve this issue. Tomorrow (07/22/2020), it is going to be released (2.3.10.RELEASE
), which is going to be pulled in by Spring Boot 2.2.9.RELEASE
(scheduled for 07/23/2020). Therefore, when that Boot release is available, you should update your application to use that (2.2.9.REELASE
).
Upvotes: 1