spring-cloud / spring-cloud-stream-binder-kafka

Spring Cloud Stream binders for Apache Kafka and Kafka Streams
Apache License 2.0
331 stars 301 forks source link

DefaultErrorHandler not exists #1200

Closed dulm closed 2 years ago

dulm commented 2 years ago

error:

org.springframework.context.ApplicationContextException: Failed to start bean 'inputBindingLifecycle'; nested exception is java.lang.NoClassDefFoundError: org/springframework/kafka/listener/DefaultErrorHandler

because spring-integration-kafka has import org.springframework.kafka:spring-kafka:2.6.6 override the 2.8.0

org.springframework.kafka:spring-kafka:2.6.6
\--- org.springframework.integration:spring-integration-kafka:5.4.4
     \--- org.springframework.cloud:spring-cloud-stream-binder-kafka-core:3.2.1 (requested org.springframework.integration:spring-integration-kafka:5.5.5)
          \--- org.springframework.cloud:spring-cloud-stream-binder-kafka:3.2.1
               \--- compileClasspath

org.springframework.kafka:spring-kafka:2.8.0 -> 2.6.6
\--- org.springframework.cloud:spring-cloud-stream-binder-kafka:3.2.1
     \--- compileClasspath

fix by manullly require 2.8.0

sobychacko commented 2 years ago

@dulm What is your boot version? Boot overrides the Spring for Apache Kafka dependency regardless of what version the binder used at compile time. These are the corresponding versions that binder 3.2.1 uses. I don't see how you use Spring Kafka 2.6. One way that could happen is if you are using an older version of Boot. Binder 3.2.x is compatible with Boot 2.6+. Please make sure that you are at that level of Boot and see if that resolves your issue.

sobychacko commented 2 years ago

Closing the issue due to no activity. Feel free to re-open if you are still facing issues.

dulm commented 2 years ago

my versions:

springbootVersion = '2.4.3'
springCloudStreamVersion = '3.2.1'
garyrussell commented 2 years ago

The DefaultErrorHandler was introduced in spring-kafka 2.8, which is used by Boot 2.6; you can't use it with Boot 2.4 (which is no longer supported). Spring Cloud Stream 3.2.x also requires Boot 2.6. Currently 3.2.2 and 2.6.7 respectively.