Pax Web 8.0.6 & Swagger UI

56 views
Skip to first unread message

Jakub Herkel

unread,
Aug 11, 2022, 3:27:47 PM8/11/22
to OPS4J
During our upgrading to the latest karaf 4.4.1 I found a problem with CXF 3.5.3 and Swagger UI (3.52.5). We dynamically export openapi descriptions so when developers
display a webpage localhost:8181/cxf they are able to display Swagger UI for a specific endpoint.
Everything worked fine with Karaf 4.3.6 but now I can see this exception:
10:58:19.288 ERROR [qtp568267022-1055] HTTP 404 Not Found
javax.ws.rs.NotFoundException: HTTP 404 Not Found
    at org.apache.cxf.jaxrs.swagger.ui.SwaggerUiService.getResource(SwaggerUiService.java:155) ~[!/:3.5.3]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
    at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179) ~[!/:3.5.3]
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) ~[!/:3.5.3]
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:201) ~[!/:3.5.3]
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:104) ~[!/:3.5.3]
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) ~[!/:3.5.3]
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) ~[!/:3.5.3]
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) ~[!/:3.5.3]
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) ~[!/:3.5.3]
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:265) ~[!/:3.5.3]
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) ~[!/:3.5.3]
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) ~[!/:3.5.3]
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) ~[!/:3.5.3]
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225) ~[!/:3.5.3]
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:304) ~[!/:3.5.3]
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:222) ~[!/:3.5.3]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:497) ~[!/:4.0.4]
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:279) ~[!/:3.5.3]
    at org.ops4j.pax.web.service.spi.servlet.OsgiInitializedServlet.service(OsgiInitializedServlet.java:74) ~[?:?]
    at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1450) ~[?:?]
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799) ~[?:?]
    at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1656) ~[?:?]
    at org.ops4j.pax.web.service.spi.servlet.OsgiFilterChain.doFilter(OsgiFilterChain.java:100) ~[?:?]
    at org.ops4j.pax.web.service.jetty.internal.PaxWebServletHandler.doHandle(PaxWebServletHandler.java:310) ~[?:?]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[?:?]
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600) ~[?:?]
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[?:?]
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[?:?]
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) ~[?:?]
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[?:?]
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440) ~[?:?]
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[?:?]
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505) ~[?:?]
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) ~[?:?]
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[?:?]
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355) ~[?:?]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[?:?]
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:191) ~[?:?]
    at org.ops4j.pax.web.service.jetty.internal.PrioritizedHandlerCollection.handle(PrioritizedHandlerCollection.java:96) ~[?:?]
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[?:?]
    at org.eclipse.jetty.server.Server.handle(Server.java:516) ~[?:?]
    at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487) ~[?:?]
    at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732) ~[?:?]
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479) ~[?:?]
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277) ~[?:?]
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) ~[?:?]
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) ~[?:?]
    at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) ~[?:?]
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338) ~[?:?]
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315) ~[?:?]
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) ~[?:?]
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) ~[?:?]
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409) ~[?:?]
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) ~[?:?]
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) ~[?:?]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.io.IOException: Resource does not exist: bundle://91689fbf-561e-4103-8a87-941e22597525_256.0:0/META-INF/resources/webjars/swagger-ui/3.52.5//index.html
    at org.apache.felix.framework.URLHandlersBundleURLConnection.<init>(URLHandlersBundleURLConnection.java:137) ~[?:?]
    at org.apache.felix.framework.URLHandlersBundleStreamHandler.openConnection(URLHandlersBundleStreamHandler.java:66) ~[?:?]
    at java.net.URL.openConnection(URL.java:1094) ~[?:?]
    at java.net.URL.openStream(URL.java:1161) ~[?:?]
    at org.apache.cxf.jaxrs.swagger.ui.SwaggerUiService.getResource(SwaggerUiService.java:149) ~[!/:3.5.3]
    ... 59 more

I also checked Swagger UI bundle and I could see that a file META-INF/resources/webjars/swagger-ui/3.52.5/index.html existed.

Within our feature we install these dependencies:
<bundle>mvn:org.webjars/swagger-ui/3.52.5</bundle>
<feature>cxf-rs-description-openapi-v3</feature>

Could it be a bug?

Jakub




Grzegorz Grzybek

unread,
Aug 16, 2022, 7:15:58 AM8/16/22
to op...@googlegroups.com
Hello

I've created https://github.com/ops4j/org.ops4j.pax.web/issues/1747 for this problem - if you have more details (though you provided enough), please add them there.

regards
Grzegorz Grzybek

--
--
------------------
OPS4J - http://www.ops4j.org - op...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/cb35346b-1a29-43e0-aba4-dd43df14ec6dn%40googlegroups.com.

Grzegorz Grzybek

unread,
Aug 17, 2022, 9:49:53 AM8/17/22
to op...@googlegroups.com
Hello Jakub

I started checking https://github.com/ops4j/org.ops4j.pax.web/issues/1747 and I've installed:
 - CXF 3.5.3
 - mvn:org.webjars/swagger-ui/3.52.5

But I guess without any OpenAPI configured CXF endpoints, I can't reproduce your problem... Do you have a sample rest endpoint bundle I could check?

regards
Grzegorz Grzybek

czw., 11 sie 2022 o 21:27 Jakub Herkel <jhe...@gmail.com> napisał(a):
Reply all
Reply to author
Forward
0 new messages