Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-5802

Service Component created via xml defines scope='singleton' and service specifies property with scope='bundle'

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: framework-5.6.10
    • Fix Version/s: None
    • Component/s: Framework
    • Labels:
      None

      Description

      Component with scope='singleton' created via xml or annotation has the service registered with a property of service.scope='bundle'

      Project reproducing the issue is available here: https://github.com/mattrpav/felix-5802 

      Steps to reproduce:

      1. Define a serviceComponent via xml (or osgi ds annotation)
      2. Deploy bundle
      3. run scr:info (observe Service Scope: singleton)
      4. run service:list (observe service.scope = bundle)

      Investigation:

       scr:info output:

      karaf@root()> scr:info TestModule
      *** Bundle: com.foo.test-module (124)
      Component Description:
      Name: BundleModule
      Implementation Class: com.foo.TestModule
      Default State: enabled
      Activation: immediate
      Configuration Policy: optional
      Activate Method: activate
      Deactivate Method: deactivate
      Modified Method: -
      Configuration Pid: [TestModule]
      Services: 
      com.foo.api.Module
      Service Scope: singleton
      Component Description Properties:
      Component Configuration:
      ComponentId: 4
      State: active 
      Component Configuration Properties:
      component.id = 4
      component.name = TestModule

      service:list output

      karaf@root()> service:list
      [com.foo.api.Module]
      ------------------------
      component.id = 4
      component.name = TestModule
      service.bundleid = 124
      service.id = 141 
      service.scope = bundle
      
      Provided by :
      Company :: Foo :: TestModule (124)

      OSGI-INF/serviceComponent.xml

      <?xml version="1.0" encoding="utf-8"?>
      <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0"      name="TestModule" immediate="true">
          <service scope="singleton">
              <provide interface="com.foo.api.Module" />
          </service>
          <implementation class="com.foo.TestModule" />
      </scr:component>

       

      Note: When the same impl class is reconfigured to register as a service via BundleActivator, the service has a service.scope = 'singleton' 

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                mattrpav Matt Pavlovich
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: