2 Replies Latest reply on Jun 24, 2010 5:45 AM by Fernando Salceda

    IllegalStateException: BeanFactory not initialized ...

    Fernando Salceda Novice

      When I try to install a component or exit from karaf console, It fails saying:

       

       

      on exit:

       

      Exception in thread "Timer-7" java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

           at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:153)

           at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:941)

           at org.apache.servicemix.common.osgi.EndpointExporter.getEndpoints(EndpointExporter.java:70)

           at org.apache.servicemix.common.osgi.EndpointExporter.checkAndRegisterSA(EndpointExporter.java:136)

           at org.apache.servicemix.common.osgi.EndpointExporter$2.run(EndpointExporter.java:156)

           at java.util.TimerThread.mainLoop(Timer.java:512)

           at java.util.TimerThread.run(Timer.java:462)

       

       

      on installing component:

       

      Exception in thread "SpringOsgiExtenderThread-56" java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

           at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:153)

           at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.close(DependencyWaiterApplicationContextExecutor.java:345)

           at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.fail(DependencyWaiterApplicationContextExecutor.java:401)

           at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:287)

           at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:175)

           at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:175)

           at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:718)

           at java.lang.Thread.run(Thread.java:595)

        • 1. Re: IllegalStateException: BeanFactory not initialized ...
          Fernando Salceda Novice

          Perhaps it isn't related with the previous error, but when I uninstall ode feature I get:

           

          Exception in thread "SpringOsgiExtenderThread-3" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0': Invocation of init method failed; nested exception is java.io.IOException: Transport Connector could not be registered in JMX: Transport scheme NOT recognized:

               at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:147)

               at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:350)

               at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1331)

               at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)

               at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

               at java.security.AccessController.doPrivileged(Native Method)

               at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)

               at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)

               at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

               at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)

               at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

               at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)

               at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)

               at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)

               at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)

               at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)

               at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)

               at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)

               at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)

               at java.lang.Thread.run(Thread.java:595)

          Caused by: java.io.IOException: Transport Connector could not be registered in JMX: Transport scheme NOT recognized:

               at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:27)

               at org.apache.activemq.broker.BrokerService.registerConnectorMBean(BrokerService.java:1591)

               at org.apache.activemq.broker.BrokerService.startTransportConnector(BrokerService.java:2012)

               at org.apache.activemq.broker.BrokerService.startAllConnectors(BrokerService.java:1965)

               at org.apache.activemq.broker.BrokerService.start(BrokerService.java:495)

               at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:85)

               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

               at java.lang.reflect.Method.invoke(Method.java:585)

               at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:297)

               at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:250)

               at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:144)

               ... 19 more

          Caused by: java.io.IOException: Transport scheme NOT recognized:

               at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:27)

               at org.apache.activemq.transport.TransportFactory.findTransportFactory(TransportFactory.java:204)

               at org.apache.activemq.transport.TransportFactory.bind(TransportFactory.java:123)

               at org.apache.activemq.broker.TransportConnector.createTransportServer(TransportConnector.java:305)

               at org.apache.activemq.broker.TransportConnector.getServer(TransportConnector.java:137)

               at org.apache.activemq.broker.TransportConnector.asManagedConnector(TransportConnector.java:100)

               at org.apache.activemq.broker.BrokerService.registerConnectorMBean(BrokerService.java:1586)

               ... 30 more

          Caused by: java.lang.IllegalStateException: Bundle "mvn:org.apache.derby/derby/10.5.3.0_1" has been uninstalled

               at org.eclipse.osgi.framework.internal.core.AbstractBundle.checkValid(AbstractBundle.java:1160)

               at org.eclipse.osgi.framework.internal.core.BundleHost.checkLoader(BundleHost.java:185)

               at org.eclipse.osgi.framework.internal.core.BundleHost.getResource(BundleHost.java:270)

               at org.apache.activemq.util.osgi.Activator.create(Activator.java:137)

               at org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:146)

               at org.apache.activemq.transport.TransportFactory.findTransportFactory(TransportFactory.java:201)

          • 2. Re: IllegalStateException: BeanFactory not initialized ...
            Fernando Salceda Novice

            It happens only when I have a servicemix-cxf-bc component installed. I've changed from 4.2.0-fuse-01-00 to 4.2.0-fuse-01-00, and also changed component versions of dependencies. But now I can't install my binding components because of previous errors.

             

            I append my consumer binding component, but perhaps I should update my springframework namespaces in bean.xml?: