Apr 4th, 2008, 11:58 PM
I have an existing application that I am converting to OSGI and have some questions about using SpringDM.
Prior to OSGI I loaded the application context using ClassPathXmlApplicationContext and access necessary beans. A necessary bean is now in a different bundle as a service. I thought I could aquire the service by implementing the BundleContextAware interface to access it using the BundleContext. However, when I load the application context setBundleContext is never invoked. However, it is invoked when the application context is loaded by something else...the Extender Service...I think. Is there a way to get to the other instance of the application context to get to the bundle context...to acquire the service?
That method did not seem like the best approach. Docs and sample code seem to point to using the osgi:reference tag to specify the service as a property for my bean in the existing application context file. I tried this approach but when I create the application context with this reference using ClassPathXmlApplicationContext I get an exception:
org.springframework.beans.factory.parsing.BeanDefi nitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/osgi]
So, I am looking for guidance for the best method to acquire a service and how to resolve the above exception?