[英]Spring Cloud Stream @ServiceActivator not messaging to errorChannel on exception
[英]Error in startup application when using @ServiceActivator in Spring cloud Stream
我把@ServiceActivator 用來記錄所有給kafka 出錯的消息:
@ServiceActivator(inputChannel = "errorChannel")
public void handleErrors(final ErrorMessage in) {
log.error("encountered exception" + em.toString());
}
而且我還將errorChannelEnabled標志設置為true:
cloud:
stream:
function:
definition: consumeProfile
bindings:
#kafka producer
produceProfile-out-0:
binder: kafka
destination: profile
producer:
use-native-encoding: true
error-channel-enabled: true
問題是當我上傳應用程序時,我收到了這個錯誤日志:
org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'profileListener.handleErrors.serviceActivator': Requested bean is currently in creation: Is there an unresolvable circular reference?
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.beforeSingletonCreation(DefaultSingletonBeanRegistry.java:355) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:227) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1160) ~[spring-context-5.3.21.jar:5.3.21]
at org.springframework.integration.monitor.IntegrationMBeanExporter.enhanceHandlerMonitor(IntegrationMBeanExporter.java:865) ~[spring-integration-jmx-5.5.13.jar:5.5.13]
at org.springframework.integration.monitor.IntegrationMBeanExporter.registerHandler(IntegrationMBeanExporter.java:695) ~[spring-integration-jmx-5.5.13.jar:5.5.13]
at org.springframework.integration.monitor.IntegrationMBeanExporter.postProcessAbstractEndpoint(IntegrationMBeanExporter.java:340) ~[spring-integration-jmx-5.5.13.jar:5.5.13]
at org.springframework.integration.monitor.IntegrationMBeanExporter.postProcessAfterInitialization(IntegrationMBeanExporter.java:324) ~[spring-integration-jmx-5.5.13.jar:5.5.13]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:455) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1808) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.integration.config.annotation.MessagingAnnotationPostProcessor.postProcessMethodAndRegisterEndpointIfAny(MessagingAnnotationPostProcessor.java:257) ~[spring-integration-core-5.5.13.jar:5.5.13]
at org.springframework.integration.config.annotation.MessagingAnnotationPostProcessor.lambda$processAnnotationTypeOnMethod$1(MessagingAnnotationPostProcessor.java:215) ~[spring-integration-core-5.5.13.jar:5.5.13]
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) ~[na:na]
at org.springframework.integration.config.annotation.MessagingAnnotationPostProcessor.afterSingletonsInstantiated(MessagingAnnotationPostProcessor.java:136) ~[spring-integration-core-5.5.13.jar:5.5.13]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:974) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.21.jar:5.3.21]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.21.jar:5.3.21]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.1.jar:2.7.1]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.1.jar:2.7.1]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.1.jar:2.7.1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.1.jar:2.7.1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.7.1.jar:2.7.1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-2.7.1.jar:2.7.1]
at com.github.victorsilva95.pocspringcloudstreamkafka.PocSpringCloudStreamKafkaApplication.main(PocSpringCloudStreamKafkaApplication.java:14) ~[main/:na]
我的應用程序沒有因為這個異常而崩潰,但我希望你能幫助理解原因,謝謝
謝謝你的樣品。
這是IntegrationMBeanExporter
中的一個錯誤:我們嘗試在MessagingAnnotationPostProcessor
創建端點 bean 時對其進行拉取。
所以,請在 Spring Integration 項目中提出一個 GH 問題,我們將看看我們能做些什么。
同時,作為一種解決方法,您可以通過相應的 Srping Boot 屬性關閉 JMX: spring.jmx.enabled=false
。 無論 Spring Boot 默認決定如何,我們都會默認為 Spring Integration 自動配置它:
@ConditionalOnProperty(prefix = "spring.jmx", name = "enabled", havingValue = "true", matchIfMissing = true)
protected static class IntegrationJmxConfiguration {
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.