1 Reply Latest reply on Aug 27, 2013 8:43 AM by ashutosh700_kmr_ashutosh

    Bundle fails on start. Invalid BundleContext

    fuse.aesik

      Hello, forum.

       

      I'm using Fuse ESB 7.1 and I have some unexpected behavior while execute commands: restart or update or refresh on a bundle which has fragment bundle with Camel routes in Spring context.

      Time to time bundle fails on (re-)start after commands above and throws exception like shown below. It is happens only when there is some payload on Camel routes (such as JMS messages, CXF Endpoint calls, Oracle AQ messages, etc) at same time with bundle (re-)starting.

      My guess is that Camel context or Spring context is no time to init properly to the moment when some parts of routes starts to work.

      And question is how to prevent this action? How to tell to Fuse ESB that bundle is ready to work only when all Spring beans and Camel context is inited?

       

      15:30:09,620 | DEBUG | ExtenderThread-8 | org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext | 112 - org.springframework.context - 3.0.7.RELEASE | Post refresh error

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jms' defined in URL bundle://324.1:0/META-INF/spring/app-context.xml : Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camelUEQContext': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Invalid BundleContext.

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:526)[ 113:org.springframework.beans:3.0.7.RELEASE ]

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)[ 113:org.springframework.beans:3.0.7.RELEASE ]

           at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)[ 113:org.springframework.beans:3.0.7.RELEASE ]

           at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)[ 113:org.springframework.beans:3.0.7.RELEASE ]

           at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)[ 113:org.springframework.beans:3.0.7.RELEASE ]

           at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)[ 113:org.springframework.beans:3.0.7.RELEASE]

           at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)[ 113:org.springframework.beans:3.0.7.RELEASE]

           at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)[ 112:org.springframework.context:3.0.7.RELEASE ]

           at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)[ 122:org.springframework.osgi.core:1.2.1 ]

           at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)[ 122:org.springframework.osgi.core:1.2.1 ]

           at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[ 122:org.springframework.osgi.core:1.2.1 ]

           at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[ 122:org.springframework.osgi.core:1.2.1 ]

           at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[ 121:org.springframework.osgi.extender:1.2.1 ]

           at java.lang.Thread.run(Thread.java:679)[ :1.6.0_24 ]

      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camelContext': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Invalid BundleContext.

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1422)[ 113:org.springframework.beans:3.0.7.RELEASE ]

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)[ 113:org.springframework.beans:3.0.7.RELEASE ]

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)[ 113:org.springframework.beans:3.0.7.RELEASE ]

           at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)[ 113:org.springframework.beans:3.0.7.RELEASE ]

           at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)[ 113:org.springframework.beans:3.0.7.RELEASE ]

           at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)[ 113:org.springframework.beans:3.0.7.RELEASE ]

           at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)[ 113:org.springframework.beans:3.0.7.RELEASE ]

           at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1079)[ 112:org.springframework.context:3.0.7.RELEASE ]

           at org.apache.camel.spring.CamelBeanPostProcessor$1.getOrLookupCamelContext(CamelBeanPostProcessor.java:69)[ 155:org.apache.camel.camel-spring:2.10.0.fuse-71-047 ]

           at org.apache.camel.impl.DefaultCamelBeanPostProcessor.postProcessBeforeInitialization(DefaultCamelBeanPostProcessor.java:85)[ 153:org.apache.camel.camel-core:2.10.0.fuse-71-047 ]

           at org.apache.camel.spring.CamelBeanPostProcessor.postProcessBeforeInitialization(CamelBeanPostProcessor.java:148)[ 155:org.apache.camel.camel-spring:2.10.0.fuse-71-047 ]

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:393)[ 113:org.springframework.beans:3.0.7.RELEASE ]

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1415)[ 113:org.springframework.beans:3.0.7.RELEASE ]

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)[ 113:org.springframework.beans:3.0.7.RELEASE ]

           ... 13 more

      Caused by: java.lang.IllegalStateException: Invalid BundleContext.

           at org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)[ org.apache.felix.framework-4.0.3.fuse-71-047.jar: ]

           at org.apache.felix.framework.BundleContextImpl.getBundle(BundleContextImpl.java:112)[ org.apache.felix.framework-4.0.3.fuse-71-047.jar: ]

           at org.apache.camel.core.osgi.OsgiCamelContextNameStrategy.(OsgiSpringCamelContext.java:37)[ 155:org.apache.camel.camel-spring:2.10.0.fuse-71-047 ]

           at org.apache.camel.osgi.CamelContextFactoryBean.newCamelContext(CamelContextFactoryBean.java:59)[ 155:org.apache.camel.camel-spring:2.10.0.fuse-71-047 ]

           at org.apache.camel.osgi.CamelContextFactoryBean.createContext(CamelContextFactoryBean.java:50)[ 155:org.apache.camel.camel-spring:2.10.0.fuse-71-047 ]

           at org.apache.camel.spring.CamelContextFactoryBean.getContext(CamelContextFactoryBean.java:337)[ 155:org.apache.camel.camel-spring:2.10.0.fuse-71-047 ]

           at org.apache.camel.spring.CamelContextFactoryBean.getContext(CamelContextFactoryBean.java:79)[ 155:org.apache.camel.camel-spring:2.10.0.fuse-71-047 ]

           at org.apache.camel.core.xml.AbstractCamelContextFactoryBean.getContext(AbstractCamelContextFactoryBean.java:427)[ 155:org.apache.camel.camel-spring:2.10.0.fuse-71-047 ]

           at org.apache.camel.core.xml.AbstractCamelContextFactoryBean.afterPropertiesSet(AbstractCamelContextFactoryBean.java:153)[ 155:org.apache.camel.camel-spring:2.10.0.fuse-71-047 ]

           at org.apache.camel.osgi.CamelContextFactoryBean.afterPropertiesSet(CamelContextFactoryBean.java:64)[ 155:org.apache.camel.camel-spring:2.10.0.fuse-71-047 ]

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1479)[ 113:org.springframework.beans:3.0.7.RELEASE ]

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1419)[ 113:org.springframework.beans:3.0.7.RELEASE ]

           ... 26 more

       

      Thanks for any advice.

       

      P.S. sorry for my bad english.

       

      Best regards, Anthony.