Camel-cxf dependencies problem as: jetty-7.3.1 is servlet-2.5 and cxf-2.4.0 is servlet-3.0 dependent ----------------------------------------------------------------------------------------------------
Key: CAMEL-3941 URL: https://issues.apache.org/jira/browse/CAMEL-3941 Project: Camel Issue Type: Bug Components: build system, camel-cxf Affects Versions: 2.8.0 Environment: Apache ServiceMix 4.4-SNAPSHOT Reporter: Piotr Klimczak Probably because of this: https://issues.apache.org/jira/browse/CAMEL-3784 i have a problem with CXF dependencies in Camel as: 1. Camel 2.8 uses CXF 2.4.0 and Jetty 7.3.1 2. CXF 2.4.0 uses servlet 3.0 3. Jetty 7.x.x uses servlet 2.5 Let's take a look at my example: {code:xml} <bean id="sampleBean" class="com.acme.Service" /> <cxfEndpoint id="acmeService" address="/acmeService" serviceClass="#sampleBean" xmlns="http://camel.apache.org/schema/spring" /> <camelContext id="testContext" trace="true" streamCache="false" xmlns="http://camel.apache.org/schema/spring" > <route> <from uri="cxf:bean:acmeService" /> <bean ref="sampleBean" /> </route> </camelContext> {code} Quite simple isn't it? But how come that we have Servlet spec version conflict? Let's take a look at class CXFConsumer of camel-cxf component: Around the lines 66 we have: {code} if (!endpoint.isSynchronous() && (continuation = getContinuation(cxfExchange)) != null) { LOG.trace("Calling the Camel async processors."); return asyncInvoke(cxfExchange, continuation); } else { {code} so if we use async API (set as default) it will try to pickup the Continuation as you can see around 111 line: {code} private Continuation getContinuation(Exchange cxfExchange) { ContinuationProvider provider = (ContinuationProvider)cxfExchange.getInMessage().get(ContinuationProvider.class.getName()); return provider == null ? null : provider.getContinuation(); } {code} The ContinuationProvider contains value of class Servlet3ContinuationProvider(cxf-rt-transports-http) which is Servlet 3.0 ready only! Let's go further to see what is happening in Servlet3Continuation(cxf-rt-transports-http) class: {code} HttpServletRequest req; //some code final AsyncContext context; //some code context = req.startAsync(req, resp); {code} If you take a closer look at AsyncContext class you will see that cxf 2.4.0 is expecting this class to be javax.servlet.AsyncContext type. BUT jetty 7 returns org.eclipse.jetty.server.AsyncContext which is incompatible. The worse thing is, that *req* value of type org.eclipse.jetty.server.Request that implements HttpServletRequest is expecting the HttpServletRequest to be 3.0 Servlet spec but is the 2.5 servlet spec one. All of this causes: {code} Caused by: java.lang.AbstractMethodError: org.eclipse.jetty.server.Request.startAsync(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)Ljavax/servlet/AsyncContext; at org.apache.cxf.transport.http.Servlet3ContinuationProvider$Servlet3Continuation.<init>(Servlet3ContinuationProvider.java:77)[142:org.apache.cxf.bundle:2.4.0] at org.apache.cxf.transport.http.Servlet3ContinuationProvider.getContinuation(Servlet3ContinuationProvider.java:58)[142:org.apache.cxf.bundle:2.4.0] at org.apache.camel.component.cxf.CxfConsumer$1.getContinuation(CxfConsumer.java:114)[205:org.apache.camel.camel-cxf:2.8.0.SNAPSHOT] at org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:66)[205:org.apache.camel.camel-cxf:2.8.0.SNAPSHOT] at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)[142:org.apache.cxf.bundle:2.4.0] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_24] at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_24] at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_24] at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)[142:org.apache.cxf.bundle:2.4.0] at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)[142:org.apache.cxf.bundle:2.4.0] ... 34 more {code} -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira