首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Camel拦截器与CXF拦截器冲突

Camel拦截器与CXF拦截器冲突
EN

Stack Overflow用户
提问于 2017-09-18 09:07:03
回答 1查看 456关注 0票数 0

我使用的是自定义InterceptStrategy,它在SOAP响应成功后抛出错误。

错误: java.lang.IllegalStateException:在org.apache.catalina.core.AsyncContextImpl.getRequest(AsyncContextImpl.java:224) at org.apache.catalina.core.AsyncContextImpl.dispatch(AsyncContextImpl.java:153) at org.springframework.security.web.servletapi.HttpServlet3RequestFactory$SecurityContextAsyncContext.dispatch(HttpServlet3RequestFactory.java:291) at org.apache.cxf.transport.http.Servlet3ContinuationProvider$Servlet3Continuation.redispatch(Servlet3ContinuationProvider.java:125)调用complete()或任何dispatch()方法后调用getRequest()是非法的在org.apache.cxf.transport.http.Servlet3ContinuationProvider$Servlet3Continuation.resume(Servlet3ContinuationProvider.java:131)

代码语言:javascript
复制
public class ApplicationLogStrategy implements InterceptStrategy {

    @Override
    public Processor wrapProcessorInInterceptors(CamelContext context, ProcessorDefinition<?> definition,
            Processor target, Processor nextTarget) throws Exception {


            return new Processor() {
                @Override
                public void process(Exchange exchange) throws Exception {
                    System.out.println("Display" + definition);
                    if (definition.getId().equalsIgnoreCase(ApplicationConstants.INITIAL_LOG)) {
                        //setCommonFields(exchange);
                        //setSpecificFields(exchange);
                    }
                    target.process(exchange);

                }
            };

    }
}

我的骆驼路线:

代码语言:javascript
复制
 <camelContext id="id-por" xmlns="http://camel.apache.org/schema/spring">
    <route>
      <!-- route starts from the cxf webservice -->
      <from uri="cxf:bean:porEndpoint" />
      <doTry>
        <to uri="bean:soapBean?method=processSOAP"/>
        <bean id="soap_success" method="processSuccess" ref="soapBean"/>
        <camel:bean id="published_log"  method="info('Message - SUCCESS')" ref="logger"/>
            <doCatch>
                <camel:exception>java.lang.Exception</camel:exception>
                <handled>
                    <constant>true</constant>
                </handled>
                <to uri="bean:soapBean?method=processGenericError"/>
        </doCatch>
      </doTry>
    </route>
</camelContext>

在记录消息"Message - SUCCESS“后抛出错误。:

代码语言:javascript
复制
<camel:bean id="published_log"  method="info('Message - SUCCESS')" ref="logger"/>

我添加了<stop/>,但运气不佳,仍然抛出错误:在complete()或任何dispatch()方法之后调用getRequest()是非法的

EN

回答 1

Stack Overflow用户

发布于 2017-09-19 06:43:04

代替target.process(exchange);

就是return target;

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46270269

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档