3 Replies Latest reply on Sep 24, 2012 9:12 PM by thomas.diesler

    Issues with BluePrint and ServiceTracker

    charlie7

      I am starting with OSGI and Blueprint

       

      The structure of my project is as follows

       

      ApiProject (OSGI) ----           Project containg the interfaces

       

      ImplProject (OSGI) ----         Project containing the implementaion of interfaces

       

      WebProject (non-OSGI)      Project containg a servlet which access a service defined in the OSGI project ( ApiProject )

       

      The issue that is happning is that when I use an activator in the ImplProject and register the service, I am able to access it using a serviceTracker in the WebProject.

       

      But if I use blueprint and register the service as shown below

       

            <bean id="mainservice"

                      class="com.link.services.echo.MainServiceImpl"

                      init-method="startUp">

              </bean>

       

                <service ref="mainservice"

                      interface="com.link.services.MainService" />

       

      I am not able to retrieve the service using the serviceTracker.

       

      I am using the the standalone-full.xml with the below added and subsystem xmlns="urn:jboss:domain:osgi:1.2" set to eager

                     <capability name="org.apache.aries:org.apache.aries.util:0.4" startlevel="2"/>

                      <capability name="org.apache.aries.proxy:org.apache.aries.proxy:0.4" startlevel="2"/>

                      <capability name="org.apache.aries.blueprint:org.apache.aries.blueprint:0.4" startlevel="2"/>

       

      My question is that Does Blueprint have any issues in working with ServiceTracker etc

       

      Thanks in advance

        • 1. Re: Issues with BluePrint and ServiceTracker
          thomas.diesler

          This should work in theory. What does the debug log say?

          • 2. Re: Issues with BluePrint and ServiceTracker
            charlie7

            Further checking I found that having the startlevel="2" was not starting up aries , blueprint etc

            After making them as follows

             

                           <capability name="org.apache.aries:org.apache.aries.util:0.4" />

                            <capability name="org.apache.aries.proxy:org.apache.aries.proxy:0.4" />

                            <capability name="org.apache.aries.blueprint:org.apache.aries.blueprint:0.4" />

             

            starts all of them . I say that w.r.t the checkmark in the OSGI section of the admin console

            After this I am able to access the services through the ServiceTracker

             

            Thanks

            • 3. Re: Issues with BluePrint and ServiceTracker
              thomas.diesler

              Having those bundles at startlevel=2 should also work. Did you tell the framework to go up to that level?

               

              <!-- Specifies the beginning start level of the framework -->

              <property name="org.osgi.framework.startlevel.beginning">2</property>