ash123
ash123

Reputation: 307

Exposing osgi service as JAX-RS using apache cxf

Can somebody provide me a simple example to expose a Restful service using apache cxf in an osgi bundle deployed on apache felix. We do not have the option to use Apache Karaf or any other application server. Also , we plan to use iPojo for dependency injection.

Upvotes: 0

Views: 648

Answers (1)

Christian Schneider
Christian Schneider

Reputation: 19606

Unfortunately installing CXF in plain apache felix is not very easy. Your best bet is to install on apache karaf first and get the list of required bundles from there.

You can find an example for cxf and rest with Apache Karaf here.

As you migrate you might need to tune the system package exports of felix to exclude the packages CXF wants to install as bundles.

I found something that may further help you. Type these commands in karaf 3.0.3:

feature:repo-add cxf 3.0.4
kar:create cxf-3.0.4 cxf-jaxrs

This will create a kar file in data/kar that contains the cxf feature file as well as all the jars (from the cxf feature). It allows you to specify which cxf features you need and quickly gather the required bundles. It will still be some work to make it work in felix but at least it helps a bit on the way.

Upvotes: 2

Related Questions