PDA

View Full Version : Spring beans in bundle not correctly created by AbstractConfigurableBundleCreatorTest



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

insen
Jul 14th, 2009, 04:06 PM
Btw I got this to work in dm-server by using Require-Bundle tag in my manifest and adding the root bundle in the code that starts the bean factory

Costin Leau
Jul 28th, 2009, 04:24 AM
Moved the thread to the dm Server forum...

insen
Jul 31st, 2009, 03:31 PM
This is not dm-server specific but more to do wtih spring-dm

Costin Leau
Aug 5th, 2009, 02:18 AM
insen, apologies if the thread was moved incorrectly but you've mentioend several times dm-server in your posts hence the reaction.