[ 
https://issues.apache.org/jira/browse/KARAF-5664?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Matt Pavlovich updated KARAF-5664:
----------------------------------
    Description: 
Project reproducing the issue is available here: 
[https://github.com/mattrpav/karaf-5664] 

Steps to reproduce:
 # Define a serviceComponent via xml (or osgi ds annotation)
 # Deploy bundle
 # run scr:info (observe Service Scope: singleton)
 # run service:list (observe service.scope = bundle)

Investigation:
 * Debugging in felix.scr confirms that the xml is being parsed correctly and 
the returned component metadata shows the 'scope' = 'singleton' correctly 
[o.a.felix.scr.impl.xml.XmlHandler#L362|https://github.com/apache/felix/blob/trunk/scr/src/main/java/org/apache/felix/scr/impl/xml/XmlHandler.java#L362]
 * Debugging confirms that felix.scr is detecting DS13 namespace

 scr:info output:
{noformat}
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{noformat}
service:list output
{noformat}
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){noformat}
OSGI-INF/serviceComponent.xml
{noformat}
<?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>{noformat}
 

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

  was:
Project reproducing the issue is available here: 
[https://github.com/mattrpav/karaf-5664] 

Steps to reproduce:
 # Define a serviceComponent via xml
 # Deploy bundle
 # run scr:info (observe Service Scope: singleton)
 # run service:list (observe service.scope = bundle)

Investigation:
 * Debugging in felix.scr confirms that the xml is being parsed correctly and 
the returned component metadata shows the 'scope' = 'singleton' correctly 
[o.a.felix.scr.impl.xml.XmlHandler#L362|https://github.com/apache/felix/blob/trunk/scr/src/main/java/org/apache/felix/scr/impl/xml/XmlHandler.java#L362]
 * Debugging confirms that felix.scr is detecting DS13 namespace

 scr:info output:
{noformat}
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{noformat}
service:list output
{noformat}
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){noformat}
OSGI-INF/serviceComponent.xml
{noformat}
<?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>{noformat}
 

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


> Service Component created via xml defines scope='singleton' and service is 
> created with scope='bundle'
> ------------------------------------------------------------------------------------------------------
>
>                 Key: KARAF-5664
>                 URL: https://issues.apache.org/jira/browse/KARAF-5664
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-scr
>    Affects Versions: 4.1.5
>            Reporter: Matt Pavlovich
>            Priority: Major
>
> Project reproducing the issue is available here: 
> [https://github.com/mattrpav/karaf-5664] 
> Steps to reproduce:
>  # Define a serviceComponent via xml (or osgi ds annotation)
>  # Deploy bundle
>  # run scr:info (observe Service Scope: singleton)
>  # run service:list (observe service.scope = bundle)
> Investigation:
>  * Debugging in felix.scr confirms that the xml is being parsed correctly and 
> the returned component metadata shows the 'scope' = 'singleton' correctly 
> [o.a.felix.scr.impl.xml.XmlHandler#L362|https://github.com/apache/felix/blob/trunk/scr/src/main/java/org/apache/felix/scr/impl/xml/XmlHandler.java#L362]
>  * Debugging confirms that felix.scr is detecting DS13 namespace
>  scr:info output:
> {noformat}
> 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{noformat}
> service:list output
> {noformat}
> 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){noformat}
> OSGI-INF/serviceComponent.xml
> {noformat}
> <?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>{noformat}
>  
> Note: When the same impl class is reconfigured to register as a service via 
> BundleActivator, the service has a service.scope = 'singleton'



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to