I'm trying to have CDI and OSGi work well together and I'm trying to deploy DeltaSpike in OSGi.
Doing so, I'm hitting https://issues.jboss.org/browse/WELD-1309
I wonder if any of the CDI / OSGi guys around have already thought about the problem.

So sum up, the problem is how to package / use CDI extensions in OSGi.   DeltaSpike provide some bundles which can be deployed, but they don't work well in OSGi.   The reason is that a lot of the CDI stuff assume a flat classloader.  The Weld-Osgi project tries to make that work better but there are still problems:
  * extension discovery: atm, the META-INF/services declaration for extensions are only found in the bundle, not in other bundles
  * only classes from the bundle are considered as beans, not classes that may be part of the extension

I would think, we want extensions to be specifically declared for a given bundle : we need to know for a given bundle which extensions should be loaded.  I've trying so far by doing discovery of beans and extensions using the bundle classloader and the classloaders of required bundles.   It seems to work, but I'm not really sure it's the way to go, especially I'm not sure that all beans defined by a bundle which is an extension should be added to the bundle using that extension (the extension being itself a bundle can already have its own CDI container).

Thoughts ?


--
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
FuseSource, Integration everywhere
http://fusesource.com