how to setup a fuse/blueprint cxf test - NoSuchMethodError: javax.servlet.http.HttpServletResponse.getStatus()I

196 views Asked by At

My camel-blueprint project contains a simple rest endpoint to provide a status. All works fine.

But now i want to create an integration test and i need to run the rest route from within a junit test. I have many working tests that extend CamelBlueprintTestSupport.

But i can't get a working test that really serves an rest endpoint. I fought through many exceptions an added many dependencies. Now i added all stuff that is mentioned in this example (i am using current versions). All exeptions that occurred on booting up the context are gone now.

But on fireing a request against the configured endpoint i still get this exception: NoSuchMethodError: javax.servlet.http.HttpServletResponse.getStatus()I

Here is the stacktrace:

org.apache.cxf.interceptor.Fault: !(Jetty || Servlet 3.0 || ContinuationFilter) while invoking public abstract java.lang.String ...ServiceStatusInterface.requestGet() with params [].
    at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:166)
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:140)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:200)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:252)
    at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:234)
    at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1129)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1065)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:499)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: !(Jetty || Servlet 3.0 || ContinuationFilter)
    at org.eclipse.jetty.continuation.ContinuationSupport.getContinuation(ContinuationSupport.java:108)
    at org.apache.cxf.transport.http_jetty.continuations.JettyContinuationWrapper.<init>(JettyContinuationWrapper.java:46)
    at org.apache.cxf.transport.http_jetty.continuations.JettyContinuationProvider.getContinuation(JettyContinuationProvider.java:64)
    at org.apache.cxf.transport.http_jetty.continuations.JettyContinuationProvider.getContinuation(JettyContinuationProvider.java:52)
    at org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.getContinuation(CxfRsInvoker.java:78)
    at org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.performInvocation(CxfRsInvoker.java:66)
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
    ... 21 more
2016-11-17 17:48:10,749 WARN  [ty-service] org.apache.cxf.phase.PhaseInterceptorChain: Exception in handleFault on interceptor org.apache.cxf.jaxrs.interceptor.JAXRSDefaultFaultOutInterceptor@3231c28a
org.apache.cxf.interceptor.Fault: !(Jetty || Servlet 3.0 || ContinuationFilter) while invoking public abstract java.lang.String ...ServiceStatusInterface.requestGet() with params [].
    at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:166)
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:140)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:200)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:252)
    at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:234)
    at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1129)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1065)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:499)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: !(Jetty || Servlet 3.0 || ContinuationFilter)
    at org.eclipse.jetty.continuation.ContinuationSupport.getContinuation(ContinuationSupport.java:108)
    at org.apache.cxf.transport.http_jetty.continuations.JettyContinuationWrapper.<init>(JettyContinuationWrapper.java:46)
    at org.apache.cxf.transport.http_jetty.continuations.JettyContinuationProvider.getContinuation(JettyContinuationProvider.java:64)
    at org.apache.cxf.transport.http_jetty.continuations.JettyContinuationProvider.getContinuation(JettyContinuationProvider.java:52)
    at org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.getContinuation(CxfRsInvoker.java:78)
    at org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.performInvocation(CxfRsInvoker.java:66)
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
    ... 21 more
2016-11-17 17:48:10,751 ERROR [ty-service] org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver: Error occurred during error handling, give up!
org.apache.cxf.interceptor.Fault: !(Jetty || Servlet 3.0 || ContinuationFilter) while invoking public abstract java.lang.String ...ServiceStatusInterface.requestGet() with params [].
    at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:166)
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:140)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:200)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:252)
    at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:234)
    at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1129)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1065)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:499)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: !(Jetty || Servlet 3.0 || ContinuationFilter)
    at org.eclipse.jetty.continuation.ContinuationSupport.getContinuation(ContinuationSupport.java:108)
    at org.apache.cxf.transport.http_jetty.continuations.JettyContinuationWrapper.<init>(JettyContinuationWrapper.java:46)
    at org.apache.cxf.transport.http_jetty.continuations.JettyContinuationProvider.getContinuation(JettyContinuationProvider.java:64)
    at org.apache.cxf.transport.http_jetty.continuations.JettyContinuationProvider.getContinuation(JettyContinuationProvider.java:52)
    at org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.getContinuation(CxfRsInvoker.java:78)
    at org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.performInvocation(CxfRsInvoker.java:66)
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
    ... 21 more
2016-11-17 17:48:10,751 WARN  [ty-service] org.eclipse.jetty.server.HttpChannel: /cxf/status/atacama-security-service
java.lang.IllegalStateException: !(Jetty || Servlet 3.0 || ContinuationFilter)
    at org.eclipse.jetty.continuation.ContinuationSupport.getContinuation(ContinuationSupport.java:108)
    at org.apache.cxf.transport.http_jetty.continuations.JettyContinuationWrapper.<init>(JettyContinuationWrapper.java:46)
    at org.apache.cxf.transport.http_jetty.continuations.JettyContinuationProvider.getContinuation(JettyContinuationProvider.java:64)
    at org.apache.cxf.transport.http_jetty.continuations.JettyContinuationProvider.getContinuation(JettyContinuationProvider.java:52)
    at org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.getContinuation(CxfRsInvoker.java:78)
    at org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.performInvocation(CxfRsInvoker.java:66)
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:200)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:252)
    at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:234)
    at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1129)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1065)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:499)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:745)
2016-11-17 17:48:10,753 WARN  [1185459-29] org.eclipse.jetty.util.thread.QueuedThreadPool: 
java.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.getStatus()I
    at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine$1.handle(JettyHTTPServerEngine.java:361)
    at org.eclipse.jetty.server.Response.sendError(Response.java:597)
    at org.eclipse.jetty.server.HttpChannel.handleException(HttpChannel.java:487)
    at org.eclipse.jetty.server.HttpConnection$HttpChannelOverHttp.handleException(HttpConnection.java:594)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:399)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:745)

So what to do about it?

EDIT

The test doesn't do anything:

@Test
public void flow() throws InterruptedException {
    mockEndpointResult.setExpectedMessageCount(1);
    mockEndpointResult.setResultWaitTime(60000);
    //context().createProducerTemplate().sendBody(in,"");

    assertMockEndpointsSatisfied();

}

I set a breakpoint on assert and try to reach the rest route via browser. (All works fine if deployed on fuse)

0

There are 0 answers