This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Using CXF and Failover in OSGi environment
Skip to end of metadata
Go to start of metadata


Apache CXF JAX-RS and JAX-WS clients can be configured to become failover-capable. Core CXF Failover and Load Distribution features are supported. It is also supported by OSGi blueprints, including the recent failover implementation based on circuit breakers. We are going to illustrate the typical example of using OSGi blueprint for registering failover-aware clients in Apache Karaf 4.0.x container.


As our example is going to be based on circuit breakers failover, there are a couple of features and additional bundles required to be installed.

feature:install cxf-jaxws cxf-features-clustering

install -s mvn:org.apache.cxf.samples/failover_server
install -s mvn:org.apache.cxf.samples/failover_jaxws_osgi
install -s wrap:mvn:org.codeartisans/org.json/20130213
install -s mvn:joda-time/joda-time/2.8.1
install -s mvn:org.qi4j.core/org.qi4j.core.functional/2.1
install -s mvn:org.qi4j.core/org.qi4j.core.api/2.1
install -s mvn:org.qi4j.core/
install -s mvn:org.qi4j.core/org.qi4j.core.spi/2.1
install -s mvn:org.qi4j.core/org.qi4j.core.bootstrap/2.1
install -s mvn:org.qi4j.library/org.qi4j.library.jmx/2.1
install -s mvn:org.qi4j.library/org.qi4j.library.circuitbreaker/2.1

Blueprint Configuration

Once all prerequisites are installed, the configuration becomes really trivial, for example here is the OSGi blueprint snippet which registers JAX-WS  failover-aware client. Although it uses circuit-breaker-failover, the way to register regular failover and loadDistribution features is very similar.

<blueprint xmlns=""

    <service ref="sampleServiceProxy" 
        interface="org.apache.cxf.samples.failover.jaxws.SampleService" />

    <jaxws:client id="sampleServiceProxy" serviceClass="org.apache.cxf.samples.failover.jaxws.SampleService">
                    <bean id="strategy" class="org.apache.cxf.clustering.SequentialStrategy">
                       <property name="alternateAddresses">
                           <list id="alternateAddresses" value-type="java.lang.String">


There are sample projects available: distribution\src\main\release\samples\clustering\failover_jaxws_osgi

  • No labels