0

The following is prompted in console when trying to launch a spring cloud streams project with the Kafka binder active:

org.springframework.context.ApplicationContextException: Failed to start bean 'inputBindingLifecycle';
Caused by: java.lang.NoSuchMethodError: java.util.List.of(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/List;

My input method goes as follows using Spring Cloud functions:

    @Bean
    public Function<Message<String>, byte[]> exec() {
        return input -> ...

Now, having Kafka in place, my .properties file looks as follows:

spring.cloud.stream.function.bindings.exec-in-0=in
spring.cloud.stream.bindings.in.destination=topic-0
spring.cloud.stream.function.bindings.exec-out-0=out
spring.cloud.stream.bindings.out.destination=topic-1

spring.cloud.stream.bindings.in.binder=kafka
spring.cloud.stream.kafka.bindings.in.consumer.configuration.value.deserializer=org.apache.kafka.common.serialization.StringDeserializer

spring.cloud.stream.bindings.out.binder=kafka
spring.cloud.stream.kafka.bindings.out.producer.configuration.value.serializer=org.apache.kafka.common.serialization.ByteArraySerializer

Am I missing any configs for the input method? Should that method be different for Kafka (already tested this with PubSub and it works)?

czr_RR
  • 541
  • 5
  • 16
  • Consider to upgrade to the latest Spring Cloud Stream: https://spring.io/projects/spring-cloud-stream#learn – Artem Bilan May 26 '22 at 16:35
  • @ArtemBilan that would be nice ye, quite a big project and I have to plan it carefully (would update to latest ASAP if I could), but got to fit Kafka with the current setup sadly :( – czr_RR May 26 '22 at 16:40
  • 1
    Well, you may try just upgrade Spring Integration to latest: https://spring.io/projects/spring-integration#learn. As far as I know that error reminds me my old mistake: https://github.com/spring-projects/spring-integration/issues/3761. That's why I advice to upgrade because the error has been fixed. – Artem Bilan May 26 '22 at 16:45
  • @ArtemBilan oh, it was exactly that! Thanks a lot! Hopefully I can upgrade everything to the latest anytime soon... – czr_RR May 26 '22 at 16:52

1 Answers1

1

The error in your stack trace gives us a clue that you are facing this problem: https://github.com/spring-projects/spring-integration/issues/3761.

So, or upgrade to the latest Spring Cloud Stream: https://spring.io/projects/spring-cloud-stream#learn

Or to the latest Spring Integration: https://spring.io/projects/spring-integration#learn

Or just use Java > 8 !

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118