3 Replies Latest reply on Jun 18, 2014 12:14 PM by xavierbutt

    Error restarting fabric containers with CXF soap clients

    xavierbutt

      I have a simple CXF soap client for Salesforce that works well for my team's purposes. In a normal fuse environment this service starts up just fine. When deployed in a fabric container it deploys and starts just fine. However when I stop and restart the container is when it fails with the following cause: org.apache.cxf.BusException: No binding factory for namespace http://schemas.xmlsoap.org/wsdl/soap/ registered.

       

      After some research I believe this error occurs because the CXF Service is being created before the org.apache.cxf.bus.osgi.CXFActivator can register the extensions in the cxf-rt-bindings-soap bundle. What would be the best way to fix this race condition, so the salesforce bundle waits for the cxf-rt-bindings-soap package to register its extensions before creating an instance of the cxf client?

        • 1. Re: Error restarting fabric containers with CXF soap clients
          xavierbutt

          I created the following github project to demonstrate this issue. gbutt/sfclient-cxf · GitHub

           

          Salesforce credentials are not necessary to reproduce the issue, as the issue occurs before the client attempts to login. Simply deploy this bundle in a fabric, stop and restart the container. On restart you should receive the error above. Note that this error only occurs if the container is managed by fabric. It works just fine in a standalone container.

          • 2. Re: Error restarting fabric containers with CXF soap clients
            ffang

            Hi,

             

            The most simple and reliable way is let your customer bundle hold a OSGi service reference exposed by cxf-rt-bindings-soap bundle, this way can ensure the cxf-rt-bindings-soap bundle get fully started before your customer bundle.

             

            add configuration like

            <reference id="cxf-soap-binding" interface="org.osgi.service.blueprint.container.BlueprintContainer" filter="(osgi.blueprint.container.symbolicname=org.apache.cxf.cxf-rt-bindings-soap)"/>

             

            into your blueprint.xml should work.

             

            Freeman

            • 3. Re: Re: Error restarting fabric containers with CXF soap clients
              xavierbutt

              Excellent suggestion. I had success adding the following service references to my CXF client blueprint:

               

              <reference id="cxf-soap-binding"
                             interface="org.apache.aries.blueprint.NamespaceHandler"
                             filter="(osgi.service.blueprint.namespace=http://cxf.apache.org/blueprint/bindings/soap)"
                          />
              
              
                  <reference id="cxf-jaxws-frontend"
                             interface="org.apache.aries.blueprint.NamespaceHandler"
                             filter="(osgi.service.blueprint.namespace=http://cxf.apache.org/blueprint/jaxws)"
                  />