Spring Integration - 堆栈溢出错误

时间:2014-03-06 14:45:07

标签: spring-integration

嗨,这是我的SI配置:

<!-- Inbound/Outbound Channels employeeSearchRequest-->
    <int:channel id="accountRequest" />
    <int:channel id="accountResponse" />
    <int:channel id="catRequestChannel" />
    <int:channel id="mataccountRequest" />
    <int:channel id="errorChannel"/>



    <int-http:inbound-gateway id="cwebAccountManagementGateway"     
        supported-methods="GET, POST" 
        request-channel="accountRequest"
        reply-channel="accountResponse" 
        mapped-request-headers="*"      
        mapped-response-headers="*" 
        view-name="/policies" 

        path="/services/{class}/{method}"
        reply-timeout="50000"
error-channel="errorChannel">




        <int-http:header name="serviceClass" expression="#pathVariables.class"/>
        <int-http:header name="serviceMethod" expression="#pathVariables.method"/>

    </int-http:inbound-gateway>


    <int:header-value-router input-channel="accountRequest"
        header-name="state"
        default-output-channel="accountRequest" resolution-required="false">
        <int:mapping value="MAT"
            channel="mataccountRequest" />
            <int:mapping value="CAT"
            channel="catRequestChannel" />

    </int:header-value-router>

    <int:service-activator id="accountServiceActivator" 
                input-channel="mataccountRequest"
                output-channel="accountResponse" 
                ref="serviceGatewayAdapter" 
                method="requestHandler" 
                send-timeout="60000"/>

        <int:service-activator id="caRequestActivator" 
                input-channel="catRequestChannel"
                output-channel="accountResponse" 
                ref="caServiceGatewayAdapter" 
                method="requestHandler" 
                send-timeout="60000"/>

                 <int:service-activator id="errorRequestActivator" 
                input-channel="errorChannel"
                output-channel="accountResponse" 
                ref="errorGatewayAdapter" 
                method="errorHandler" 
                send-timeout="60000"/>

当我调用此服务时,我发现堆栈溢出异常。当我在tomcat中尝试这个项目时,我得到了这个stak溢出异常,当我没有指定State参数作为带CAT或MAT的头时。但是当我在Websphere服务器中部署时 即使在通过状态pareameter之后我也会遇到堆栈溢出异常。请给出一些解决方案.Follwing是整个堆栈跟踪。我无法粘贴整个堆栈,因此粘贴了堆栈跟踪的一部分。

[3/6/14 9:37:25:819 EST] 0000012f ServletWrappe E   SRVE0068E: Uncaught exception thrown in one of the service methods of the servlet: Spring Integration Services. Exception thrown : org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.StackOverflowError
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:972)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1213)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1154)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:848)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:691)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:654)
    at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:526)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3673)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:269)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:831)
    at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1478)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:133)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:457)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:300)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:271)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:556)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:606)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:979)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1064)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1560)
Caused by: java.lang.StackOverflowError
    at org.springframework.integration.support.MessageBuilder.setHeader(MessageBuilder.java:104)
    at org.springframework.integration.support.MessageBuilder.copyHeaders(MessageBuilder.java:177)
    at org.springframework.integration.support.MessageBuilder.<init>(MessageBuilder.java:62)
    at org.springframework.integration.support.MessageBuilder.fromMessage(MessageBuilder.java:75)
    at org.springframework.integration.history.MessageHistory.write(MessageHistory.java:68)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:149)
    at org.springframework.integration.channel.interceptor.WireTap.preSend(WireTap.java:121)
    at org.springframework.integration.channel.AbstractMessageChannel$ChannelInterceptorList.preSend(AbstractMessageChannel.java:227)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:152)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)
    at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)
    at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)
    at org.springframework.integration.router.AbstractMessageRouter.handleMessageInternal(AbstractMessageRouter.java:145)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:115)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:102)
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)
    at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)
    at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)
    at org.springframework.integration.router.AbstractMessageRouter.handleMessageInternal(AbstractMessageRouter.java:145)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:115)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:102)
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)
    at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)
    at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)
    at org.springframework.integration.router.AbstractMessageRouter.handleMessageInternal(AbstractMessageRouter.java:145)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:115)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:102)
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)
    at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)
    at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)
    at org.springframework.integration.router.AbstractMessageRouter.handleMessageInternal(AbstractMessageRouter.java:145)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:115)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:102)
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)
    at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)
    at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)
    at org.springframework.integration.router.AbstractMessageRouter.handleMessageInternal(AbstractMessageRouter.java:145)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:115)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:102)
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:157)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:128)
    at org.springframework.integration.core.MessagingTemplate.doSend(MessagingTemplate.java:288)
    at org.springframework.integration.core.MessagingTemplate.send(MessagingTemplate.java:149)
    at org.springframework.integration.router.AbstractMessageRouter.handleMessageInternal(AbstractMessageRouter.java:145)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:115)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:102)
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend

1 个答案:

答案 0 :(得分:1)

您的<int:header-value-router/>问题:他的default-output-channelinput-channel相同。因此,如果路由器没有通过其映射解析信道,它会将消息发送到其default-output-channel,但此处此信道是获取该路由器消息的信道。由于accountRequestDirrect频道,所有工作都在同一个线程完成。它会导致StackOverflowError

只需将default-output-channel更改为任何其他适当的渠道

即可