Java 驼峰:递归调用路由时发生堆栈溢出错误

Java 驼峰:递归调用路由时发生堆栈溢出错误,java,apache,apache-camel,Java,Apache,Apache Camel,我有一条骆驼路线,在满足某个条件之前,它会自动调用。其基本思想是实现路由的重试。部署应用程序时,如果重试时间较长,则会出现stackoverflow错误 [Camel (camel-1) thread #1 - Multicast] ERROR com.application.RouteName.lambda$configure$0 - Exception occurred during execution on the exchange: Exchange[ID-batchrater-

我有一条骆驼路线,在满足某个条件之前,它会自动调用。其基本思想是实现路由的重试。部署应用程序时,如果重试时间较长,则会出现stackoverflow错误

    [Camel (camel-1) thread #1 - Multicast] ERROR com.application.RouteName.lambda$configure$0 - Exception occurred during execution on the exchange: Exchange[ID-batchrater-310822922-1-383133832-34058-1530798326741-0-6]
    org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[ID-batchrater-310822922-1-383133832-34058-1530798326741-0-6]
        at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1779)
        at org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:351)

  .
  .
  .
  .
        Caused by: java.lang.StackOverflowError: null
        at org.springframework.beans.factory.support.AbstractBeanFactory.transformedBeanName(AbstractBeanFactory.java:1117)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:239)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1084)
        at org.apache.camel.spring.spi.ApplicationContextRegistry.lookupByNameAndType(ApplicationContextRegistry.java:47)
        at org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookupByNameAndType(PropertyPlaceholderDelegateRegistry.java:63)
        at org.apache.camel.component.bean.BeanInfo.createParameterMappingStrategy(BeanInfo.java:177)
        at org.apache.camel.component.bean.BeanInfo.<init>(BeanInfo.java:99)
[Camel(Camel-1)线程#1-多播]错误com.application.RouteName.lambda$configure$0-在exchange上执行时发生异常:exchange[ID-batchrater-310822922-1-383133832-34058-1530798326741-0-6]
org.apache.camel.cameleExecutionException:在exchange上执行时发生异常:exchange[ID-batchrater-310822922-1-383133832-34058-1530798326741-0-6]
位于org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1779)
位于org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:351)
.
.
.
.
原因:java.lang.StackOverflower错误:null
位于org.springframework.beans.factory.support.AbstractBeanFactory.transformedBeanName(AbstractBeanFactory.java:1117)
位于org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:239)
位于org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
位于org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1084)
位于org.apache.camel.spring.spi.ApplicationContextRegistry.lookupynameandType(ApplicationContextRegistry.java:47)
位于org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookupynameandtype(PropertyPlaceholderDelegateRegistry.java:63)
位于org.apache.camel.component.bean.BeanInfo.createParameterMappingStrategy(BeanInfo.java:177)
位于org.apache.camel.component.bean.BeanInfo.(BeanInfo.java:99)
我相信stackoverflow错误是由于route的递归调用造成的,我更改了route结构,现在重新交付由camel
OneException()中可用的retryDelivery机制处理。在满足条件之前,我的重试次数是无限的


我需要知道,使用这种方法是否会再次出现堆栈溢出。

否这是使用OneException和其他错误处理功能处理错误处理重新交付的正确方法。使用循环EIP会导致更长的堆栈帧,不应用于很长的循环。所以你做了正确的修复