FAQ
I am running camel 2.9 inside spring batch. It worked perfectly for small
number of records, but when number of records is high camel lag behind
spring batch. When spring batch completes it tries to close application
context, as a result camelContext’s stop method is invoked.
DefaultShutdownStratgey is configured with proper timeout. But looks like
spring is destroying camelTemplate before camelContext causing
BeanCreationNotAllowedException when camel tries to process record.
Here is the exception that I am getting

2012-02-07 14:25:13,535 INFO
[org.apache.camel.impl.DefaultShutdownStrategy.run(431)] - <Waiting as there
are still 43 inflight and pending exchanges to complete, timeout in 209
seconds.>
2012-02-07 14:25:14,253 DEBUG
[org.apache.camel.processor.DefaultErrorHandler.debug(72)] - <Failed
delivery for exchangeId: ID-msidd-1478-1328642429988-0-15. On delivery
attempt: 0 caught: org.apache.camel.RuntimeCamelException:
org.springframework.beans.factory.BeanCreationNotAllowedException: Error
creating bean with name 'camelTemplate': Singleton bean creation not allowed
while the singletons of this factory are in destruction (Do not request a
bean from a BeanFactory in a destroy method implementation!)>
2012-02-07 14:25:14,253 ERROR
[org.apache.camel.processor.DefaultErrorHandler.error(161)] - <Failed
delivery for exchangeId: ID-msidd-1478-1328642429988-0-15. Exhausted after
delivery attempt: 1 caught: org.apache.camel.RuntimeCamelException:
org.springframework.beans.factory.BeanCreationNotAllowedException: Error
creating bean with name 'camelTemplate': Singleton bean creation not allowed
while the singletons of this factory are in destruction (Do not request a
bean from a BeanFactory in a destroy method implementation!)>
org.apache.camel.RuntimeCamelException:
org.springframework.beans.factory.BeanCreationNotAllowedException: Error
creating bean with name 'camelTemplate': Singleton bean creation not allowed
while the singletons of this factory are in destruction (Do not request a
bean from a BeanFactory in a destroy method implementation!)
at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1196)
at
org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookup(PropertyPlaceholderDelegateRegistry.java:51)
at
org.apache.camel.component.bean.RegistryBean.lookupBean(RegistryBean.java:136)
at
org.apache.camel.component.bean.RegistryBean.getBean(RegistryBean.java:62)
at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:83)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:322)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:213)
at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:117)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:122)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:61)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:115)
at
org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:285)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:322)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:213)
at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:81)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:322)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:213)
at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:248)
at
org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:160)
at org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:131)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by:
org.springframework.beans.factory.BeanCreationNotAllowedException: Error
creating bean with name 'camelTemplate': Singleton bean creation not allowed
while the singletons of this factory are in destruction (Do not request a
bean from a BeanFactory in a destroy method implementation!)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:209)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:281)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1075)
at
org.apache.camel.spring.spi.ApplicationContextRegistry.lookup(ApplicationContextRegistry.java:66)
at
org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookup(PropertyPlaceholderDelegateRegistry.java:49)
... 67 more

--
View this message in context: http://camel.465427.n5.nabble.com/Spring-destroys-camelTemplate-before-CamelContext-tp5464452p5464452.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Search Discussions

  • Claus Ibsen at Feb 8, 2012 at 9:12 am
    Hi

    You can possible use depends-on or something to declare the spring
    batch depends on <camelContext>

    And did you define a bean as camelTemplate or did you not declare the
    camel template explicit?


    On Tue, Feb 7, 2012 at 9:27 PM, muhammad siddique
    wrote:
    I am running camel 2.9 inside spring batch. It worked perfectly for small
    number of records, but when number of records is high camel lag behind
    spring batch. When spring batch completes it tries to close application
    context, as a result camelContext’s stop method is invoked.
    DefaultShutdownStratgey is configured with proper timeout. But looks like
    spring is destroying camelTemplate before camelContext causing
    BeanCreationNotAllowedException when camel tries to process record.
    Here is the exception that I am getting

    2012-02-07 14:25:13,535 INFO
    [org.apache.camel.impl.DefaultShutdownStrategy.run(431)] - <Waiting as there
    are still 43 inflight and pending exchanges to complete, timeout in 209
    seconds.>
    2012-02-07 14:25:14,253 DEBUG
    [org.apache.camel.processor.DefaultErrorHandler.debug(72)] - <Failed
    delivery for exchangeId: ID-msidd-1478-1328642429988-0-15. On delivery
    attempt: 0 caught: org.apache.camel.RuntimeCamelException:
    org.springframework.beans.factory.BeanCreationNotAllowedException: Error
    creating bean with name 'camelTemplate': Singleton bean creation not allowed
    while the singletons of this factory are in destruction (Do not request a
    bean from a BeanFactory in a destroy method implementation!)>
    2012-02-07 14:25:14,253 ERROR
    [org.apache.camel.processor.DefaultErrorHandler.error(161)] - <Failed
    delivery for exchangeId: ID-msidd-1478-1328642429988-0-15. Exhausted after
    delivery attempt: 1 caught: org.apache.camel.RuntimeCamelException:
    org.springframework.beans.factory.BeanCreationNotAllowedException: Error
    creating bean with name 'camelTemplate': Singleton bean creation not allowed
    while the singletons of this factory are in destruction (Do not request a
    bean from a BeanFactory in a destroy method implementation!)>
    org.apache.camel.RuntimeCamelException:
    org.springframework.beans.factory.BeanCreationNotAllowedException: Error
    creating bean with name 'camelTemplate': Singleton bean creation not allowed
    while the singletons of this factory are in destruction (Do not request a
    bean from a BeanFactory in a destroy method implementation!)
    at
    org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1196)
    at
    org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookup(PropertyPlaceholderDelegateRegistry.java:51)
    at
    org.apache.camel.component.bean.RegistryBean.lookupBean(RegistryBean.java:136)
    at
    org.apache.camel.component.bean.RegistryBean.getBean(RegistryBean.java:62)
    at
    org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:83)
    at
    org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at
    org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
    at
    org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
    at
    org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
    at
    org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at
    org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:322)
    at
    org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:213)
    at
    org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
    at
    org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
    at
    org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
    at
    org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:117)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
    at
    org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
    at
    org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
    at
    org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:122)
    at
    org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at
    org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
    at
    org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
    at
    org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
    at
    org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at
    org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:61)
    at
    org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at
    org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:115)
    at
    org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:285)
    at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110)
    at
    org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at
    org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
    at
    org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
    at
    org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
    at
    org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at
    org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:322)
    at
    org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:213)
    at
    org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
    at
    org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
    at
    org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
    at
    org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at
    org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
    at
    org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:81)
    at
    org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at
    org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
    at
    org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
    at
    org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
    at
    org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at
    org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:322)
    at
    org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:213)
    at
    org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
    at
    org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
    at
    org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
    at
    org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
    at
    org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
    at
    org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)
    at
    org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)
    at
    org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at
    org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
    at
    org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
    at
    org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
    at
    org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at
    org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:248)
    at
    org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:160)
    at org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:131)
    at
    java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
    Caused by:
    org.springframework.beans.factory.BeanCreationNotAllowedException: Error
    creating bean with name 'camelTemplate': Singleton bean creation not allowed
    while the singletons of this factory are in destruction (Do not request a
    bean from a BeanFactory in a destroy method implementation!)
    at
    org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:209)
    at
    org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at
    org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at
    org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:281)
    at
    org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at
    org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1075)
    at
    org.apache.camel.spring.spi.ApplicationContextRegistry.lookup(ApplicationContextRegistry.java:66)
    at
    org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookup(PropertyPlaceholderDelegateRegistry.java:49)
    ... 67 more

    --
    View this message in context: http://camel.465427.n5.nabble.com/Spring-destroys-camelTemplate-before-CamelContext-tp5464452p5464452.html
    Sent from the Camel - Users mailing list archive at Nabble.com.


    --
    Claus Ibsen
    -----------------
    FuseSource
    Email: cibsen@fusesource.com
    Web: http://fusesource.com
    Twitter: davsclaus, fusenews
    Blog: http://davsclaus.blogspot.com/
    Author of Camel in Action: http://www.manning.com/ibsen/
  • Muhammad siddique at Feb 8, 2012 at 3:20 pm
    Thanks for reply
    I already tried depends-on, it didn't work. Spring is closing camelContext
    before the destruction of any other bean..but after destroying
    camelTemplate.

    I probably need a need a way to tell spring that camelTemplate depends on
    camelContet.
    And yes i am explicitly defining camelTemplate in xml. Here is how

    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"
    trace="true" autoStartup="true" shutdownRoute="Defer"
    shutdownRunningTask="CompleteAllTasks" errorHandlerRef="dlc" >
    <jmxAgent id="agent" disabled="true"/>
    <errorHandler id="dlc"
    type="DeadLetterChannel"
    deadLetterUri="file:deadLetter">
    </errorHandler>

    <template id="camelTemplate" camelContextId="camel"/>

    <route id="person-event" shutdownRoute="Defer">
    .........................
    </route>
    <route .........
    </route>
    Looks like it is not a problem with spring batch. I plugged-in the exact
    configuration in our web app and got the same exception on server shutdown
    when some exchanges are inflisht.

    --
    View this message in context: http://camel.465427.n5.nabble.com/Spring-destroys-camelTemplate-before-CamelContext-tp5464452p5466783.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • Muhammad siddique at Feb 8, 2012 at 11:35 pm
    I tried removing camelTemplate from spring configuration and creating camel
    Producer template from camel context in my POJO. Here is what i got

    2012-02-08 17:26:01,144 DEBUG
    [org.apache.camel.processor.DefaultErrorHandler.debug(72)] - <Failed
    delivery for exchangeId: ID-msidd-3710-1328739667175-0-17. On delivery
    attempt: 0 caught: org.apache.camel.RuntimeCamelException:
    org.springframework.beans.factory.BeanCreationNotAllowedException: Error
    creating bean with name 'camel': Singleton bean creation not allowed while
    the singletons of this factory are in destruction (Do not request a bean
    from a BeanFactory in a destroy method implementation!)>


    It looks like spring has no way to find that camel Context is the bean that
    should be destroyed first.
    I looked into code of SpringCamelContext and it doesn't implement
    SmartLifecycle interface from spring. If it does , we will probably have a
    way to tell spring its creation and destruction order.

    --
    View this message in context: http://camel.465427.n5.nabble.com/Spring-destroys-camelTemplate-before-CamelContext-tp5464452p5468029.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • Claus Ibsen at Feb 10, 2012 at 7:06 am

    On Thu, Feb 9, 2012 at 12:35 AM, muhammad siddique wrote:
    I tried removing camelTemplate from spring configuration and creating camel
    Producer template from camel context in my POJO. Here is what i got

    2012-02-08 17:26:01,144 DEBUG
    [org.apache.camel.processor.DefaultErrorHandler.debug(72)] - <Failed
    delivery for exchangeId: ID-msidd-3710-1328739667175-0-17. On delivery
    attempt: 0 caught: org.apache.camel.RuntimeCamelException:
    org.springframework.beans.factory.BeanCreationNotAllowedException: Error
    creating bean with name 'camel': Singleton bean creation not allowed while
    the singletons of this factory are in destruction (Do not request a bean
    from a BeanFactory in a destroy method implementation!)>


    It looks like spring has no way to find that camel Context is the bean that
    should be destroyed first.
    I looked into code of SpringCamelContext and it doesn't implement
    SmartLifecycle interface from spring. If it does , we will probably have a
    way to tell spring its creation and destruction order.
    If the SmartLifecycle is part of Spring 3.0 api, then that would be
    possible to improve in camel-spring, as we are spring 3.0+ api
    compatible.
    We love contributions at Apache Camel. So take a dive into and see if
    you can help with this.
    http://camel.apache.org/contributing.html
    --
    View this message in context: http://camel.465427.n5.nabble.com/Spring-destroys-camelTemplate-before-CamelContext-tp5464452p5468029.html
    Sent from the Camel - Users mailing list archive at Nabble.com.


    --
    Claus Ibsen
    -----------------
    FuseSource
    Email: cibsen@fusesource.com
    Web: http://fusesource.com
    Twitter: davsclaus, fusenews
    Blog: http://davsclaus.blogspot.com/
    Author of Camel in Action: http://www.manning.com/ibsen/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedFeb 7, '12 at 8:27p
activeFeb 10, '12 at 7:06a
posts5
users2
websitecamel.apache.org

2 users in discussion

Muhammad siddique: 3 posts Claus Ibsen: 2 posts

People

Translate

site design / logo © 2022 Grokbase