0 Replies Latest reply on Nov 20, 2014 8:36 AM by Andreas Neupert

    OSGi Bundle export package

    Andreas Neupert Newbie

      Hi,

       

      I have an OSGi Bundle and a servlet. Now I want to access the bundle from the servlet. For that purpose I use the following in the servlet:

       

      @Resource

      BundleContext context

      ...

      ServiceReference ref = context.getServiceReference("myclass");

      MyOSGiServiceInterface service = context.getService(ref);

       

      The Problem is that my servlet doesn't know MyOSGiServiceInterface 'cause that is defined in the OSGiBundle. In Eclipse I added a reference to the bundle Project in my Build Path. But at runtime it obviously can't find it.

      To solve that Problem I played around with Export-Package: package-of-osgi-service-interface (in bundle manifest), Import-Package: package-of-osgi-service-Interface (in servlet manifest) and Dependencies: ...,deployment.MyBundle (also in servlet manifest)

      But I couldn't solve it.

       

      Whats the missing step? How can I tell JBoss to add the package containing MyOSGiServiceInterface in OSGiBundle to the class path?

       

      Thanks for answers!

       

      (JBoss AS 7.1.1)