You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by neykov <gi...@git.apache.org> on 2016/04/12 13:31:03 UTC

[GitHub] cxf pull request: Fixes a NPE if Bus is not registered

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 <sv...@cloudsoftcorp.com>
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cxf pull request: Fixes a NPE if Bus is not registered

Posted by cschneider <gi...@git.apache.org>.
Github user cschneider commented on the pull request:

    https://github.com/apache/cxf/pull/129#issuecomment-215970036
  
    We indeed have a race condition here. The code I wrote will update the ConduitFactory even when the config comes late but this will not influence endpoints that are already created. 
    
    To target a specific bus would also not help as the bus creation is in control of the bundle that owns it. To tackle this is a correct way we would need a completely different approach. 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cxf pull request: Fixes a NPE if Bus is not registered

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the pull request:

    https://github.com/apache/cxf/pull/129#issuecomment-215959913
  
    Thanks @cschneider closing this in favour of your changes.
    
    For the case of multiple buses - wondering whether the client service should be able to target a specific bus (by name) instead of using the last seen configuration which is indeterministic due to bundle load order not being predefined.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cxf pull request: Fixes a NPE if Bus is not registered

Posted by cschneider <gi...@git.apache.org>.
Github user cschneider commented on the pull request:

    https://github.com/apache/cxf/pull/129#issuecomment-215722590
  
    I think this is still not correct. When a config update is received it takes a bus service from the ServiceTracker. The problem is that there is not only one CXF bus service in OSGi. So I think we need a completely different approach for this. I will try to sync with Dan or Sergey to find a good solution.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cxf pull request: Fixes a NPE if Bus is not registered

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the pull request:

    https://github.com/apache/cxf/pull/129#issuecomment-215466185
  
    Would be great if you give it a go. Agree current implementation doesn't work for multiple buses. Thanks @cschneider .


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cxf pull request: Fixes a NPE if Bus is not registered

Posted by neykov <gi...@git.apache.org>.
Github user neykov closed the pull request at:

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


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cxf pull request: Fixes a NPE if Bus is not registered

Posted by cschneider <gi...@git.apache.org>.
Github user cschneider commented on the pull request:

    https://github.com/apache/cxf/pull/129#issuecomment-215464414
  
    I checked with Dan Kulp how to solve the multiplicity of the busses. He has a good idea:
    "Thus, the activator should be tracking al the bus things.  It should then likely to a bus.getExtension(AsyncHTTPConduit.class) to retrieve the existing conduit and configure it".
    
    I think that should work fine. Do you want to change the PR accordingly? If not I can also tackle the implementation next week.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cxf pull request: Fixes a NPE if Bus is not registered

Posted by cschneider <gi...@git.apache.org>.
Github user cschneider commented on the pull request:

    https://github.com/apache/cxf/pull/129#issuecomment-211933996
  
    I think this is still not correct. When a config update is received it takes a bus service from the ServiceTracker. The problem is that there is not only one CXF bus service in OSGi. So I think we need a completely different approach for this. I will try to sync with Dan or Sergey to find a good solution.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cxf pull request: Fixes a NPE if Bus is not registered

Posted by cschneider <gi...@git.apache.org>.
Github user cschneider commented on the pull request:

    https://github.com/apache/cxf/pull/129#issuecomment-215723206
  
    I fixed the issue in https://issues.apache.org/jira/browse/CXF-6887. Would be great if you could validate it works for you.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---