You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by statsquad <de...@mu-sigma.com> on 2010/01/27 13:56:00 UTC

java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

Could someone help me with these error. I am trying to create a simple osgi
bundle using the maven-bundle-plugin.

1.Created the Maven project using archetype
-DarchetypeGroupId=org.springframework.osgi
-DarchetypeArtifactId=spring-osgi-bundle-archetype -DarchetypeVersion=1.2.0

2.Added beans in the META-INF/spring/bundle-context.xml as following

<file:sender service="tut:file" endpoint="sender"
directory="file:///D:/work/RealTimeWS/smxtest/output"/>
<file:poller service="tut:file" endpoint="poller"
file="file:///D:/work/RealTimeWS/smxtest/input" targetService="tut:file"
targetEndpoint="sender" />

(Used the namespace - xmlns:file="http://servicemix.apache.org/file/1.0")

3.Ran the maven build and deployed the jar file in the deploy folder
(apache-servicemix-4.1.0-SNAPSHOT)

Following is the exception stack trace in the karaf console:

karaf@root> Exception in thread "SpringOsgiExtenderThread-67"
java.lang.IllegalStateException: BeanFactory not initialized or already
closed - call 'refres
h' 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(DependencyWaiterApplicationCont
extExecutor.java:345)
        at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.fail(DependencyWaiterApplicationConte
xtExecutor.java:401)
        at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationC
ontextExecutor.java:287)
        at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationCo
ntextExecutor.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:619)

Thanks in advance.

-- 
View this message in context: http://old.nabble.com/java.lang.IllegalStateException%3A-BeanFactory-not-initialized-or-already-closed---call-%27refresh%27-before-accessing-beans-via-the-ApplicationContext-tp27338584p27338584.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.