如何设置fuse / blueprint cxf测试 - NoSuchMethodError:javax.servlet.http.HttpServletResponse.getStatus()I

时间:2016-11-17 16:58:09

标签: apache-camel cxf camel-blueprint

我的camel-blueprint项目包含一个简单的休息端点来提供状态。一切正常。

但现在我想创建一个集成测试,我需要在junit测试中运行其余路由。我有许多扩展CamelBlueprintTestSupport的工作测试。

但我无法获得真正服务于休息终点的工作测试。我经历了许多例外,增加了很多依赖。现在我添加了this example中提到的所有内容(我正在使用当前版本)。 启动上下文时发生的所有异常现在都消失了。

但是在针对配置的端点发出请求时,仍然会出现此异常:NoSuchMethodError: javax.servlet.http.HttpServletResponse.getStatus()I

这是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)

那该怎么办呢?

修改

测试没有做任何事情:

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

    assertMockEndpointsSatisfied();

}

我在assert上设置断点并尝试通过浏览器到达其余路径。 (如果部署在保险丝上,一切正常)

0 个答案:

没有答案