You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Dmytro Pishchukhin (JIRA)" <ji...@apache.org> on 2012/11/27 13:05:57 UTC

[jira] [Created] (FELIX-3787) NPE on reference update

Dmytro Pishchukhin created FELIX-3787:
-----------------------------------------

             Summary: NPE on reference update
                 Key: FELIX-3787
                 URL: https://issues.apache.org/jira/browse/FELIX-3787
             Project: Felix
          Issue Type: Bug
          Components: Declarative Services (SCR)
    Affects Versions: scr-1.6.2
            Reporter: Dmytro Pishchukhin


I defined reference with annotation:
    @Reference(referenceInterface = Controller.class, cardinality = ReferenceCardinality.MANDATORY_UNARY, policyOption = ReferencePolicyOption.GREEDY)
    protected Controller controller;

when I install a new service I got an error:
java.lang.NullPointerException
        at org.apache.felix.scr.impl.manager.DependencyManager.serviceAdded(DependencyManager.java:383)
        at org.apache.felix.scr.impl.manager.DependencyManager.serviceChanged(DependencyManager.java:159)
        at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
        at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
        at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
        at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
        at org.apache.felix.framework.Felix.registerService(Felix.java:3275) 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (FELIX-3787) NPE on reference update

Posted by "Dmytro Pishchukhin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-3787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13504576#comment-13504576 ] 

Dmytro Pishchukhin commented on FELIX-3787:
-------------------------------------------

some additional info for the issue:

- there are 1+ Controller service. The difference is only SERVICE_RANK property.
- Component is in active state when only 1 Controller service is available. Component is in registered state when 2 Controller services are registered and in WebConsole I see that "No Services bound" for all references, but state is "Satisfied". After some time the Component state changes to active  
                
> NPE on reference update
> -----------------------
>
>                 Key: FELIX-3787
>                 URL: https://issues.apache.org/jira/browse/FELIX-3787
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.6.2
>            Reporter: Dmytro Pishchukhin
>
> I defined reference with annotation:
>     @Reference(referenceInterface = Controller.class, cardinality = ReferenceCardinality.MANDATORY_UNARY, policyOption = ReferencePolicyOption.GREEDY)
>     protected Controller controller;
> when I install a new service I got an error:
> java.lang.NullPointerException
>         at org.apache.felix.scr.impl.manager.DependencyManager.serviceAdded(DependencyManager.java:383)
>         at org.apache.felix.scr.impl.manager.DependencyManager.serviceChanged(DependencyManager.java:159)
>         at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
>         at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
>         at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
>         at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
>         at org.apache.felix.framework.Felix.registerService(Felix.java:3275) 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (FELIX-3787) NPE on reference update

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-3787?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reassigned FELIX-3787:
----------------------------------------

    Assignee: Felix Meschberger
    
> NPE on reference update
> -----------------------
>
>                 Key: FELIX-3787
>                 URL: https://issues.apache.org/jira/browse/FELIX-3787
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.6.2
>            Reporter: Dmytro Pishchukhin
>            Assignee: Felix Meschberger
>
> I defined reference with annotation:
>     @Reference(referenceInterface = Controller.class, cardinality = ReferenceCardinality.MANDATORY_UNARY, policyOption = ReferencePolicyOption.GREEDY)
>     protected Controller controller;
> when I install a new service I got an error:
> java.lang.NullPointerException
>         at org.apache.felix.scr.impl.manager.DependencyManager.serviceAdded(DependencyManager.java:383)
>         at org.apache.felix.scr.impl.manager.DependencyManager.serviceChanged(DependencyManager.java:159)
>         at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
>         at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
>         at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
>         at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
>         at org.apache.felix.framework.Felix.registerService(Felix.java:3275) 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (FELIX-3787) NPE on reference update

Posted by "Dmytro Pishchukhin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-3787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13504571#comment-13504571 ] 

Dmytro Pishchukhin commented on FELIX-3787:
-------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.2.0">
    <scr:component name="com.acme.foo.agent">
        <implementation class="com.acme.foo.agent.impl.AgentImpl"/>
        <service servicefactory="false">
            <provide interface="com.acme.foo.agent.Agent"/>
        </service>
        <property name="com.acme.foo.agent.prop1.value" value="val 1"/>
        <property name="service.pid" value="com.acme.foo.agent"/>
        <reference name="context" interface="com.acme.foo.api.Provider" cardinality="1..1" policy="static" target="(com.acme.foo.provider.name=provider.archive)" bind="bindContext" unbind="unbindContext"/>
        <reference name="controller" interface="com.acme.foo.api.Controller" cardinality="1..1" policy="static" bind="bindController" unbind="unbindController" policy-option="greedy"/>
    </scr:component>
</components>

                
> NPE on reference update
> -----------------------
>
>                 Key: FELIX-3787
>                 URL: https://issues.apache.org/jira/browse/FELIX-3787
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.6.2
>            Reporter: Dmytro Pishchukhin
>
> I defined reference with annotation:
>     @Reference(referenceInterface = Controller.class, cardinality = ReferenceCardinality.MANDATORY_UNARY, policyOption = ReferencePolicyOption.GREEDY)
>     protected Controller controller;
> when I install a new service I got an error:
> java.lang.NullPointerException
>         at org.apache.felix.scr.impl.manager.DependencyManager.serviceAdded(DependencyManager.java:383)
>         at org.apache.felix.scr.impl.manager.DependencyManager.serviceChanged(DependencyManager.java:159)
>         at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
>         at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
>         at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
>         at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
>         at org.apache.felix.framework.Felix.registerService(Felix.java:3275) 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (FELIX-3787) NPE on reference update

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-3787?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved FELIX-3787.
--------------------------------------

       Resolution: Fixed
    Fix Version/s: scr-1.6.4

Thanks.

I can reproduce it now.

The issue occurs because this is a delayed component which is *not* activated yet and so the internal dependency map has not been setup, thus is null and the statement:

  Map bound = ( Map ) m_componentManager.getDependencyMap().get( this );

is expected to throw an NPE in this case.

Turns out it is nasty (and unneeded logging only) because the component has never been activated. Consequently this situation has no adverse consequences on operations (despite the logging).

Fixing this in Rev. 1414168 by guarding against missing dependencies map.
                
> NPE on reference update
> -----------------------
>
>                 Key: FELIX-3787
>                 URL: https://issues.apache.org/jira/browse/FELIX-3787
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.6.2
>            Reporter: Dmytro Pishchukhin
>            Assignee: Felix Meschberger
>             Fix For: scr-1.6.4
>
>
> I defined reference with annotation:
>     @Reference(referenceInterface = Controller.class, cardinality = ReferenceCardinality.MANDATORY_UNARY, policyOption = ReferencePolicyOption.GREEDY)
>     protected Controller controller;
> when I install a new service I got an error:
> java.lang.NullPointerException
>         at org.apache.felix.scr.impl.manager.DependencyManager.serviceAdded(DependencyManager.java:383)
>         at org.apache.felix.scr.impl.manager.DependencyManager.serviceChanged(DependencyManager.java:159)
>         at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
>         at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
>         at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
>         at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
>         at org.apache.felix.framework.Felix.registerService(Felix.java:3275) 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (FELIX-3787) NPE on reference update

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-3787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13504569#comment-13504569 ] 

Felix Meschberger commented on FELIX-3787:
------------------------------------------

Thanks for reporting.

Would you mind providing us with the component declaration which led to this issue ?

NB: I have seen this before but was not able to reproduce.
                
> NPE on reference update
> -----------------------
>
>                 Key: FELIX-3787
>                 URL: https://issues.apache.org/jira/browse/FELIX-3787
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.6.2
>            Reporter: Dmytro Pishchukhin
>
> I defined reference with annotation:
>     @Reference(referenceInterface = Controller.class, cardinality = ReferenceCardinality.MANDATORY_UNARY, policyOption = ReferencePolicyOption.GREEDY)
>     protected Controller controller;
> when I install a new service I got an error:
> java.lang.NullPointerException
>         at org.apache.felix.scr.impl.manager.DependencyManager.serviceAdded(DependencyManager.java:383)
>         at org.apache.felix.scr.impl.manager.DependencyManager.serviceChanged(DependencyManager.java:159)
>         at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
>         at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
>         at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
>         at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
>         at org.apache.felix.framework.Felix.registerService(Felix.java:3275) 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira