Hi every one !
I'm testing OSGi currently with Equinox and hopefully Spring-OSGi.
I'm trying to put a database accessor into my main bundle class, and for this, i want to use Spring-OSGi.
What I'm trying to achieve is to get the Spring BeanFactory and use it to load my database access bean, configured in the bundle-context.xml file, under the spring folder of the META-INF folder.
I figured out by myself that I was supposed to use an OsgiBundleXmlApplicationContext object to get my factory and here is how i do it :
But this always give me an exception when i call the getBeanFactory() method:Code:String[] configLocations = new ApplicationContextConfiguration(context.getBundle()).getConfigurationLocations(); bundleApplicationContext = new OsgiBundleXmlApplicationContext(context,configLocations); factory = bundleApplicationContext.getBeanFactory();
Any idea someone?Code:java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
Thank you !


