springboot 1.5.x 升级 spring-kafka 2.x NoSuchMethodError
生活随笔
收集整理的這篇文章主要介紹了
springboot 1.5.x 升级 spring-kafka 2.x NoSuchMethodError
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
今天在更新依賴版本整合springboot1.5.x和spring kafka2.x出現如下問題:
?
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 2018-06-11 15:09:29.574 ERROR 6720 --- [ main] o.s.boot.SpringApplication : Application startup failedjava.lang.NoSuchMethodError: org.springframework.util.Assert.state(ZLjava/util/function/Supplier;)Vat org.springframework.kafka.listener.adapter.MessagingMessageListenerAdapter.determineInferredType(MessagingMessageListenerAdapter.java:396) ~[spring-kafka-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.kafka.listener.adapter.MessagingMessageListenerAdapter.<init>(MessagingMessageListenerAdapter.java:100) ~[spring-kafka-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.kafka.listener.adapter.RecordMessagingMessageListenerAdapter.<init>(RecordMessagingMessageListenerAdapter.java:61) ~[spring-kafka-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.kafka.config.MethodKafkaListenerEndpoint.createMessageListenerInstance(MethodKafkaListenerEndpoint.java:172) ~[spring-kafka-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.kafka.config.MethodKafkaListenerEndpoint.createMessageListener(MethodKafkaListenerEndpoint.java:132) ~[spring-kafka-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.kafka.config.AbstractKafkaListenerEndpoint.setupMessageListener(AbstractKafkaListenerEndpoint.java:338) ~[spring-kafka-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.kafka.config.AbstractKafkaListenerEndpoint.setupListenerContainer(AbstractKafkaListenerEndpoint.java:323) ~[spring-kafka-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.kafka.config.AbstractKafkaListenerContainerFactory.createListenerContainer(AbstractKafkaListenerContainerFactory.java:227) ~[spring-kafka-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.kafka.config.AbstractKafkaListenerContainerFactory.createListenerContainer(AbstractKafkaListenerContainerFactory.java:49) ~[spring-kafka-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.kafka.config.KafkaListenerEndpointRegistry.createListenerContainer(KafkaListenerEndpointRegistry.java:182) ~[spring-kafka-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.kafka.config.KafkaListenerEndpointRegistry.registerListenerContainer(KafkaListenerEndpointRegistry.java:154) ~[spring-kafka-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.kafka.config.KafkaListenerEndpointRegistry.registerListenerContainer(KafkaListenerEndpointRegistry.java:128) ~[spring-kafka-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.kafka.config.KafkaListenerEndpointRegistrar.registerAllEndpoints(KafkaListenerEndpointRegistrar.java:138) ~[spring-kafka-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.kafka.config.KafkaListenerEndpointRegistrar.afterPropertiesSet(KafkaListenerEndpointRegistrar.java:132) ~[spring-kafka-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.kafka.annotation.KafkaListenerAnnotationBeanPostProcessor.afterSingletonsInstantiated(KafkaListenerAnnotationBeanPostProcessor.java:229) ~[spring-kafka-2.0.0.RELEASE.jar:2.0.0.RELEASE]at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:781) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]?
經過查閱相關資料發現這是版本依賴不匹配造成的即:版本之間的對應問題。
解決方法:
如果繼續使用spring-kafka2.x,那么則需要升級springboot為2.x;如果不想升級springboot,則需要將spring-kafka版本降級為1.3.x及以下
總結
以上是生活随笔為你收集整理的springboot 1.5.x 升级 spring-kafka 2.x NoSuchMethodError的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 对SVC和SVR的理解
- 下一篇: springboot2.x 与 elas