insen
Jul 9th, 2009, 04:34 PM
Hi,
I have a spring-dm environment, where I have a service using a bundle which dynamically instantiates classes via native spring (Not spring-dm or osgi). To get it to work in dm-server I had to add the Require-bundle tag to the manifest of the service using this library. This works great.
When I try to do the same thing in my integration tests it fails. The code is as folows:
AbstractApplicationContext ctx = new MyClassPathXmlApplicationContext(
contextPath);
MyContextLoader loader =(MyContextLoader)ctx.getBean(_contextBeanName);
Here I am getting an error:
MyContextLoader cannot be cast to com.core.types.impl.MyContextLoader
The bean that is created has its classLoader as sun.misc.Launcher$AppClassLoader
While the class MyContextLoader has the class loader as
org.eclipse.osgi.internal.baseadaptor.DefaultClass Loader
This causes it to fail.
I am really stuck here and do not know how to proceed.
Any help will be very much appreciated.
This all works fine under dm-server.
Thanks
/Saurav
I have a spring-dm environment, where I have a service using a bundle which dynamically instantiates classes via native spring (Not spring-dm or osgi). To get it to work in dm-server I had to add the Require-bundle tag to the manifest of the service using this library. This works great.
When I try to do the same thing in my integration tests it fails. The code is as folows:
AbstractApplicationContext ctx = new MyClassPathXmlApplicationContext(
contextPath);
MyContextLoader loader =(MyContextLoader)ctx.getBean(_contextBeanName);
Here I am getting an error:
MyContextLoader cannot be cast to com.core.types.impl.MyContextLoader
The bean that is created has its classLoader as sun.misc.Launcher$AppClassLoader
While the class MyContextLoader has the class loader as
org.eclipse.osgi.internal.baseadaptor.DefaultClass Loader
This causes it to fail.
I am really stuck here and do not know how to proceed.
Any help will be very much appreciated.
This all works fine under dm-server.
Thanks
/Saurav