I managed to reproduce the error here: 

https://github.com/mrulli/karaf-4211-cxf-swagger 
<https://github.com/mrulli/karaf-4211-cxf-swagger>

There is a thread on this subject in the Karaf mailing list as well:

http://karaf.922171.n3.nabble.com/OpenAPI-and-CXF-issues-with-Karaf-4-2-11-td4060159.html
 
<http://karaf.922171.n3.nabble.com/OpenAPI-and-CXF-issues-with-Karaf-4-2-11-td4060159.html>

Matteo



> On 31 May 2021, at 12:02, Matteo Rulli <matteo.ru...@gmail.com> wrote:
> 
> Hello,
> 
> I recently upgraded from CXF 3.3.2 to 3.4.0 and my rest endpoints stopped to 
> work. I get this error (I’m using Karaf 4.2.11 + Java 8) during pax exam test 
> boot up:
> 
> org.osgi.service.http.HttpService not found by 
> org.apache.cxf.cxf-rt-transports-http
> 
> Caused by: java.lang.ClassNotFoundException: 
> org.osgi.service.http.HttpService not found by 
> org.apache.cxf.cxf-rt-transports-http [167]
>               at 
> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1639)
>  ~[?:?]
>               at 
> org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80)
>  ~[?:?]
>               at 
> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
>  ~[?:?]
>               at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
> ~[?:1.8.0_161]
>               at 
> org.apache.cxf.transport.http.osgi.HTTPTransportActivator.start(HTTPTransportActivator.java:62)
>  ~[?:?]
> 
> I checked the exports and the imports and everything seem fine:
> 
> karaf@root()> exports -p org.osgi.service.http
> Package Name                      │ Version │ ID  │ Bundle Name
> ──────────────────────────────────┼─────────┼─────┼──────────────────────────────
> org.osgi.service.http.context     │ 1.0.0   │ 293 │ 
> org.ops4j.pax.web.pax-web-api
> org.osgi.service.http.runtime.dto │ 1.0.0   │ 293 │ 
> org.ops4j.pax.web.pax-web-api
> org.osgi.service.http.runtime     │ 1.0.0   │ 293 │ 
> org.ops4j.pax.web.pax-web-api
> org.osgi.service.http             │ 1.2.1   │ 293 │ 
> org.ops4j.pax.web.pax-web-api
> 
> karaf@root()> imports -p org.osgi.service.http
> Package                           │ Version       │ Optional │ ID  │ Bundle 
> Name
> ──────────────────────────────────┼───────────────┼──────────┼─────┼──────────────────────────────────────
> org.osgi.service.http.context     │ [1.0.0,2.0.0) │          │ 92  │ 
> flairkit.sc.servlet
> org.osgi.service.http.runtime.dto │ [1.0.0,2.0.0) │          │ 295 │ 
> org.ops4j.pax.web.pax-web-runtime
> org.osgi.service.http             │ [1.0.0,2.0.0) │          │ 294 │ 
> org.ops4j.pax.web.pax-web-jetty
> org.osgi.service.http             │ [1.0.0,2.0.0) │          │ 295 │ 
> org.ops4j.pax.web.pax-web-runtime
> org.osgi.service.http             │ [1.0.0,2.0.0) │          │ 296 │ 
> org.ops4j.pax.web.pax-web-spi
> org.osgi.service.http             │ [1.2.0,2.0.0) │ resolved │ 168 │ 
> org.apache.cxf.cxf-rt-transports-http
> org.osgi.service.http             │ [1.2.0,2.0.0) │          │ 185 │ 
> org.apache.karaf.http.core
> 
> And the HttpService seems up and running:
> 
> karaf@root()> service:list org.osgi.service.http.HttpService
> [org.osgi.service.http.HttpService, org.ops4j.pax.web.service.WebContainer]
> ---------------------------------------------------------------------------
>  felix.fileinstall.filename = 
> file.../5e9d5084-f193-4b33-b40f-71b482697646/etc/org.ops4j.pax.web.cfg
>  javax.servlet.context.tempdir = 
> /private/var/folders/dy/xdtn67n929lcfg5kbcwxly6r0000gn/T/.paxweb5610941496959273162
> ...
>  service.bundleid = 295
>  service.id <http://service.id/> = 191
>  service.pid = org.ops4j.pax.web
>  service.scope = bundle
> Provided by :
>  OPS4J Pax Web - Runtime (295)
> Used by:
>  Apache Karaf :: HTTP :: Core (185)
> 
> I have the impression that the problem could be related to the optional 
> import of the org.osgi.service.http package within the cxf-rt-transports-http 
> manifest but I’m not sure if this is the way to go trying to solve this.
> 
> Could you please provide help?
> 
> Thank you,
> Matteo
> 
> 

Reply via email to