You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Matteo Rulli <ma...@gmail.com> on 2021/06/01 08:12:33 UTC

Re: org.osgi.service.http.HttpService not found by org.apache.cxf.cxf-rt-transports-http

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 <ma...@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
> 
> 


Re: org.osgi.service.http.HttpService not found by org.apache.cxf.cxf-rt-transports-http

Posted by Matteo Rulli <ma...@gmail.com>.
Hello JB,

II tried the following:

Swagger: force the mvn:io.swagger.core.v3/swagger-jaxrs2/2.1.4 to import javax.servlet* in version range javax.servlet*;version="[0,4.1)"
CXF: remove the optional attribute for the osgi.cmpn dependency in the /cxf/rt/transports/http/pom.xml
Karaf: getting rid of the throw new UnsupportedOperationException() in the uninstall method of karaf/features/core/src/main/java/org/apache/karaf/features/internal/service/StaticInstallSupport.java
The third point was necessary as the feature was uninstalling the org.ops4j.pax.url.wrap bundle during resolution (why it was I know not). 

Overwriting locally the corresp. artifacts with these three modifications I manage to get around the issue. Obviously this is not a solution to the problem.

What would you suggest?

Many thanks,
Matteo


> On 1 Jun 2021, at 10:45, Jean-Baptiste Onofre <jb...@nanthrax.net> wrote:
> 
> Hi Matteo,
> 
> As said on the karaf mailing list, I will take a look and keep you posted.
> 
> Regards
> JB
> 
>> Le 1 juin 2021 à 10:12, Matteo Rulli <ma...@gmail.com> a écrit :
>> 
>> 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 <ma...@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
>>> 
>>> 
>> 
> 


Re: org.osgi.service.http.HttpService not found by org.apache.cxf.cxf-rt-transports-http

Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Hi Matteo,

As said on the karaf mailing list, I will take a look and keep you posted.

Regards
JB

> Le 1 juin 2021 à 10:12, Matteo Rulli <ma...@gmail.com> a écrit :
> 
> 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 <ma...@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
>> 
>> 
>