CXF DOSGi in Apache Karaf
Since version 1.4.0 of CXF DOSGi there is a feature for Apache Karaf which makes installing DOSGi really easy. Using the descriptions below a working demo should be up in less than 10 minutes.
Download and unpack Apache Karaf
- Download apache karaf
- Copy etc/jre.properties.cxf to etc/jre.properties -> This is needed in karaf 2.2.x to adjust the system package exports so CXF can install correctly
- Unpack and start it
CXF DOSGi does not work with Karaf 2.3.0. Please use at least Karaf 2.3.1.
Installation of CXF-DOSGi
features:chooseurl cxf-dosgi 1.4.0 features:install cxf-dosgi-discovery-distributed
Create config "etc/org.apache.cxf.dosgi.discovery.zookeeper.cfg" with the following content:
zookeeper.port=2181 zookeeper.host=localhost
Installation of the zookeeper Server
features:install cxf-dosgi-zookeeper-server
Create config "etc/org.apache.cxf.dosgi.discovery.zookeeper.server.cfg" with the following content:
zookeeper.host:127.0.0.1 clientPort:2181 zookeeper.port:2181
Test installation with greeter demo
install -s mvn:org.apache.cxf.dosgi.samples/cxf-dosgi-ri-samples-greeter-interface/1.4.0 install -s mvn:org.apache.cxf.dosgi.samples/cxf-dosgi-ri-samples-greeter-impl/1.4.0
log:display should show the greeter service being exported:
2013-01-07 10:50:52,108 | INFO | pool-13-thread-1 | TopologyManagerExport | r.exporter.TopologyManagerExport 257 | 114 - cxf-dosgi-ri-topology-manager - 1.4.0 | TopologyManager: export sucessful Endpoints: [Endpoint Desctiption for ServiceReference [org.apache.cxf.dosgi.samples.greeter.GreeterService] *** EndpointDescription: **** endpoint.framework.uuid => 74455213-0926-4fa8-b3eb-0f9b4d15f119 endpoint.id => http://localhost:9090/greeter endpoint.package.version.org.apache.cxf.dosgi.samples.greeter => 0.0.0 endpoint.service.id => 252 objectClass => [org.apache.cxf.dosgi.samples.greeter.GreeterService] org.apache.cxf.ws.address => http://localhost:9090/greeter service.imported => true service.imported.configs => [org.apache.cxf.ws] service.intents => [SOAP.1_1, HTTP, SOAP] ]
Access the service transparently from a second container
- Unpack karaf in a second directory and also start it.
- Do the installation steps from "Installation of CXF-DOSGi"
- Install a client to a service that is published in the first container.
- DOSGi will automatically install a proxy for you service that calls the published service remotely over CXF