Hi,

Im trying to expose some OSGI services as REST API's. (Please refer mail
thread "[Architecture] REST API for Machine Learner")
For that, i want to access the Service References of the services which
were registered in the OSGI context by their respective bundle activators,
from the web app (.war).

I tried the following methods [1] and [2], But both returns a NULL bundle
contexts.
(Here 'Project.class' is the web app's class name)

[1] BundleContext bundleContext =
FrameworkUtil.getBundle(Project.class).getBundleContext();

[2] @Context
      ServletContext servletContext;
      BundleContext bundleContext = (BundleContext)
servletContext.getAttribute("osgi-bundlecontext");

AFAIU this happens because the 'Project.class' is not loaded by an OSGi
bundle class loader, because it is bundled as an web app.

Is there a different apporach to expose the OSGi servioce as REST API's?
Can anyone please shed some light here?

-- 
*Supun Sethunga*
Software Engineer
WSO2, Inc.
lean | enterprise | middleware
Mobile : +94 716546324
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to