Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.18.2, 3.19.0
-
None
-
Unknown
Description
CxfRsConsumer class has a direct dependency to CxfUtils (from another bundle). Osgi import to package org.apache.camel.component.cxf.util is now explicity disabled, so if CxfUtils is called, that cause ClassNotFoundException from runtime.
It's easy reproducable, probably on all versions containing camel-cxf-rest bundle (after CAMEL-9627).
After fault on rest endpoint, outFaultObserver is called and that cause runtime ClassNotFoundException on osgi environments.
Example stacktrace:
java.lang.NoClassDefFoundError: org/apache/camel/component/cxf/util/CxfUtils at org.apache.camel.component.cxf.jaxrs.CxfRsConsumer.lambda$createServer$0(CxfRsConsumer.java:65) ~[?:?] at org.apache.cxf.phase.PhaseInterceptorChain.wrapExceptionAsFault(PhaseInterceptorChain.java:373) ~[?:?] at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:331) ~[?:?] at org.apache.cxf.interceptor.security.JAASLoginInterceptor$1.run(JAASLoginInterceptor.java:159) ~[?:?] at org.apache.cxf.interceptor.security.JAASLoginInterceptor$1.run(JAASLoginInterceptor.java:152) ~[?:?] at java.security.AccessController.doPrivileged(AccessController.java:399) ~[?:?] at javax.security.auth.Subject.doAs(Subject.java:376) ~[?:?] at org.apache.cxf.interceptor.security.JAASLoginInterceptor.handleMessage(JAASLoginInterceptor.java:152) ~[?:?] at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) ~[?:?] at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) ~[?:?] at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:265) ~[?:?] at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) ~[?:?] at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) ~[?:?] at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) ~[?:?] at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225) ~[?:?] at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:304) ~[?:?] at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:217) ~[?:?] at javax.servlet.http.HttpServlet.service(HttpServlet.java:517) ~[?:?] at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:279) ~[?:?] 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:234) ~[?:?] at org.ops4j.pax.web.service.jetty.internal.PrioritizedHandlerCollection.handle(PrioritizedHandlerCollection.java:96) ~[?:?]
Fix - not tested yet, but removing explict import removal from pom.xml should be enough (line containing !org.apache.camel.component.cxf.util)
Attachments
Issue Links
- duplicates
-
CAMEL-18563 camel-karaf - ClassNotDefFoundError when an exception thrown from a cxfrs route
- Resolved