If you are trying to deploy a CXF JAX-RS service inside an OSGI container, you can be haunted by the exception given below. But, surprisingly, the fix could be pretty simple 2 step process.
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:122) at javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:91) at javax.ws.rs.core.MediaType.<clinit>(MediaType.java:44) ... 56 more Caused by: java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at javax.ws.rs.ext.FactoryFinder.newInstance(FactoryFinder.java:62) at javax.ws.rs.ext.FactoryFinder.find(FactoryFinder.java:155) at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:105) ... 58 more
First, make sure you follow the steps to register your servlet through the osgi HTTP service as pointed out in the minimal osgi sample.
Then, the reason most probably would be a non-OSGIfied jsr 311 implementation present. Replace this jar with an OSGI compatible implementation located at org.apache.servicemix.specs.jsr311-api-1.1.1-1.9.0.jar.
That should (hopefully) solve your problem.