GitHub user neykov opened a pull request:

    https://github.com/apache/cxf/pull/129

    Fixes a NPE if Bus is not registered

    Just adding the bundle in an OSGi container causes a NPE in the logs 
because the Activator is called, but no Bus service is available. Even if 
there's a bundle providing the Bus service it could be registered after the 
asyncclient Activator executes so the `HTTPConduitFactory` service will be 
registered indeterministically. The changes will wait for the Bus service to 
become available and register the `HTTPConduitFactory` service.
    
    Here's the stack trace of the exception:
    ```
    2016-03-09 18:41:49,298 | ERROR | ort.http.async]) | configadmin            
          | 3 - org.apache.felix.configadmin - 1.8.8 | 
[org.osgi.service.cm.ManagedService, id=146, 
bundle=84/mvn:org.apache.cxf/cxf-rt-transports-http-hc/3.1.4]: Unexpected 
problem updating configuration org.apache.cxf.transport.http.async
    java.lang.NullPointerException
        at 
org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduitFactory.addListener(AsyncHTTPConduitFactory.java:285)[84:org.apache.cxf.cxf-rt-transports-http-hc:3.1.4]
        at 
org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduitFactory.<init>(AsyncHTTPConduitFactory.java:144)[84:org.apache.cxf.cxf-rt-transports-http-hc:3.1.4]
        at 
org.apache.cxf.transport.http.asyncclient.Activator$ConduitConfigurer.updated(Activator.java:79)[84:org.apache.cxf.cxf-rt-transports-http-hc:3.1.4]
        at 
org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)[3:org.apache.felix.configadmin:1.8.8]
        at 
org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)[3:org.apache.felix.configadmin:1.8.8]
        at 
org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)[3:org.apache.felix.configadmin:1.8.8]
        at 
org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1444)[3:org.apache.felix.configadmin:1.8.8]
        at 
org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1400)[3:org.apache.felix.configadmin:1.8.8]
        at 
org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:143)[3:org.apache.felix.configadmin:1.8.8]
        at 
org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:110)[3:org.apache.felix.configadmin:1.8.8]
        at java.lang.Thread.run(Thread.java:745)[:1.7.0_80]
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/neykov/cxf fix/missing-bus

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cxf/pull/129.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #129
    
----
commit 17e05cde74aa6639cb2d2b5d811668d941fbafb4
Author: Svetoslav Neykov <[email protected]>
Date:   2016-04-12T11:29:11Z

    Fixes a NPE if Bus is not registered
    
    Just adding the bundle in an OSGi container causes a NPE in the logs 
because the Activator is called, but no Bus service is available. Even if 
there's a bundle providing the Bus service it could be registered after the 
asyncclient Activator executes so the HTTPConduitFactory service will be 
registered indeterministically. The changes will wait for the Bus service to 
become available and register the HTTPConduitFactory service.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to