2 Replies Latest reply on Nov 12, 2010 3:07 PM by Thomas Diesler

    [JBAS-8599] Provide JNDI InitialContext as OSGi service

    Thomas Diesler Master

      Jason sais


      Are the dependencies of naming on OSGi necessary? It seems like these
      services should be created by the osgi subsystem. Is the problem making
      these optional?


      I think its correct like this. The OSGi subsystem provides the OSGi service registry. Subsystem Foo may choose to publish a service in that registry which would then readily be available for installed bundles to use. The OSGi subsystem does not need to know about Foo.


      The dependency on org.jboss.as.osgi is there because Foo provides a PASSIVE service which activates when the Framework comes up. If the Framework was coming up eagerly a dependency on org.osgi.core would be sufficient. You should see no performance impact due to these additional services (i.e. only passive service registration)

        • 1. Re: [JBAS-8599] Provide JNDI InitialContext as OSGi service
          Thomas Diesler Master

          Having said above, its one of the fundamental features of our OSGi/AS7 integration that OSGi bundles can access services that are registered using the plain MSC service API. You would not need to have a dependency on org.osgi.core let alone on org.jboss.as.osgi


          All you need to do is register the MSC service with an alias




          The OSGi API uses the FQN of the interface that the service implements. Any service that is prefixed with 'jbosgi' can be found like this using the OSGi service API. Also note, that assignability contstraints apply. So the module that provides the interface must be registered with OSGi layer and export the package or the package must be one of the Framework's system packages. The requesting bundle must be wired such that it can load see the interface.


          This is descibed in more detail in: JBoss AS7 OSGi Integration

          • 2. Re: [JBAS-8599] Provide JNDI InitialContext as OSGi service
            Thomas Diesler Master

            I did not choose to do that because the OSGi services for Tx and JNDI are in fact instances of ServiceFactory. i.e. Each requesting bundle gets its own instance.