mathieuancelin / weld-osgi

This project aims to provide an OSGi integration for Weld. This project is no longer updated, see https://github.com/weld/core for updates
https://github.com/weld/core
12 stars 10 forks source link

Integration uses the container factory service in order to get running container #49

Closed arcane86 closed 13 years ago

arcane86 commented 13 years ago

CDI-OSGi store the references to running CDI container into the container factory service. Once the CDI implementation bundle is stopped the running container are inaccessible so CDI-OSGi cannot stop the management getting: ERROR: Error stopping bundle. (java.lang.NullPointerException: Specified service reference cannot be null.) java.lang.NullPointerException: Specified service reference cannot be null. at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:319) at org.osgi.cdi.impl.integration.IntegrationActivator.factory(IntegrationActivator.java:217) at org.osgi.cdi.impl.integration.IntegrationActivator.stopCDIOSGi(IntegrationActivator.java:91) at org.osgi.cdi.impl.integration.IntegrationActivator.stop(IntegrationActivator.java:70) at org.osgi.cdi.impl.Activator.stop(Activator.java:51) at org.apache.felix.framework.util.SecureAction.stopActivator(SecureAction.java:655) at org.apache.felix.framework.Felix.stopBundle(Felix.java:2197) at org.apache.felix.framework.BundleImpl.stop(BundleImpl.java:958) at org.apache.felix.framework.BundleImpl.stop(BundleImpl.java:945) at org.apache.felix.shell.impl.StopCommandImpl.execute(StopCommandImpl.java:70) at org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activator.java:276) at org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.java:167) at java.lang.Thread.run(Thread.java:662)

The container references should be store elsewhere (as they were before one maladroit refactoring :/ )

mathieuancelin commented 13 years ago

Is it possible to catch the stopping event ? Is it possible to identifie the stopped bundle and get the container another way (with the bundle id for instance) ?

arcane86 commented 13 years ago

It's maybe possible. But i think this is design fail do to my refactoring. The references to running CDI container should be kept within the extension implement bundle rather than within the container factory service (i.e the CDI implementation bundle).