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 <abubakar.saddi...@gmail.com> 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: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/