Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Handle wevservice Timeout in Spring integration

  1. #1

    Default Handle wevservice Timeout in Spring integration

    Hi,

    I am using SpringIntegration and calling a webservice. My Application is deployed in WAS 7.0.It is working fine as long as the webservice sends response back.but if incase there is some timout occur in webservice after the request is made to webservice, the server gets hanged., with below error:
    Code:
    TimeoutManage I   WTRN0006W: Transaction 00000136581A4460000000030000000209EA42E83F47151C1457B1BF49B5622E03A56FFA00000136581A4460000000030000000209EA42E83F47151C1457B1BF49B5622E03A56FFA00000001 has timed out after 120 seconds.
    [3/28/12 15:01:38:214 HKT] 00000009 TimeoutManage I   WTRN0124I: When the timeout occurred the thread with which the transaction is, or was most recently, associated was Thread[MessageListenerThreadPool : 0,5,main]. The stack trace of this thread when the timeout occurred was: 
    	sun.misc.Unsafe.park(Native Method)
    	java.util.concurrent.locks.LockSupport.park(LockSupport.java:184)
    	java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:822)
    Can any one help me in this, how to handle the webservice timeout ? This is really very critical for my application.

    Below is my application context file code :
    Code:
    	<int:gateway id="workItemService"
    		service-interface="com.hsbc.mpfbpm.integration.service.WorkItemService"
    		default-request-channel="mpfBpmNotificationChannel"
    		default-reply-channel="jmsOutChannel" error-channel="errorChannel">
    		<int:method name="createBPMWorkItem" request-channel="mpfBpmNotificationChannel"
    			reply-channel="jmsOutChannel" >
    		</int:method>
    	</int:gateway>
    	
    	<int:chain id="chain" input-channel="mpfBpmNotificationChannel"
    		output-channel="wsInChannel">
    
    		<int:service-activator method="receiveMessage"
    			ref="ismMessageCreator">
    		</int:service-activator>
    
    		<int:service-activator method="process">
    			<bean class="com.hsbc.mpfbpm.integration.transformer.RequestFL2POJO">
    				<property name="mappingLocation" value="classpath:payloadMapping.xml" />
    			</bean>
    		</int:service-activator>
    
    		<int:header-enricher>
    			<int:header name="springintegration_ws_soapAction" value="${MPF.BPM.WSDL.URL.SoapAction}" />
    		</int:header-enricher>
    		<ws:outbound-gateway uri="${MPF.BPM.WSDL.URI}" 
    			marshaller="processWorkItemCastorMarshaller" unmarshaller="processWorkItemCastorMarshaller"
    			>
    		</ws:outbound-gateway>
    		
    	</int:chain>

  2. #2
    Join Date
    Jan 2009
    Location
    Ukraine, Kharkov
    Posts
    632

    Default

    Hello
    Try to use this one for your <ws:outbound-gateway>:
    HTML Code:
    <bean id="messageSender" class="org.springframework.ws.transport.http.CommonsHttpMessageSender"
    		  p:connectionTimeout="1000" p:readTimeout="60000"/>
    Here you'll have 1 sec for trying to connect and 1 min for waiting response.

    In another case now you are waiting response during transaction timeout - 2 mins.

    Any other questions?

    Artem Bilan

  3. #3

    Default

    Hi
    Thanks a lot for the response.
    I will try this one and will confirm, as my application depends on other system to be runnable (for webservice call).

    I have one more question, In case I have to call a https webservice, what should I use in message sender?

  4. #4
    Join Date
    Jan 2009
    Location
    Ukraine, Kharkov
    Posts
    632

    Default

    In case I have to call a https webservice, what should I use in message sender
    for good - nothing!
    You should just configure SSL on your application server, where you'll put webservice sertificate.
    On the WAS you can do it though admin console via
    SSL certificate and key management > Key stores and certificates
    and receive his sertificate from URL.

  5. #5

    Default

    Hi,
    Could you please let me know,
    What is the xsd file and jar file used for namespace p:connectionTimeout and p:readTimeout. It is giving error as "The prefix 'p' for attribute p:connectionTimeout associated with an element type 'bean' is not bound".

    Thanks in advance

  6. #6
    Join Date
    Jan 2009
    Location
    Ukraine, Kharkov
    Posts
    632

    Default

    It is giving error as "The prefix 'p' for attribute p:connectionTimeout
    This one:
    HTML Code:
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:p="http://www.springframework.org/schema/p" ---HERE---
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    http://static.springsource.org/sprin...ns-p-namespace

  7. #7

    Default

    Hi,
    The issu is still the same. the timeout is error is stil occuring.

    my code is :
    Code:
    	<int:chain id="chain" input-channel="mpfBpmNotificationChannel"
    		output-channel="wsInChannel">
    
    		<int:service-activator method="receiveMessage"
    			ref="ismMessageCreator">
    		</int:service-activator>
    
    		<int:service-activator method="process">
    			<bean class="com.hsbc.mpfbpm.integration.transformer.RequestFL2POJO">
    				<property name="mappingLocation" value="classpath:payloadMapping.xml" />
    			</bean>
    		</int:service-activator>
    
    		<int:header-enricher>
    			<int:header name="springintegration_ws_soapAction" value="${MPF.BPM.WSDL.URL.SoapAction}" />
    		</int:header-enricher>
    		<ws:outbound-gateway uri="${MPF.BPM.WSDL.URI}" message-sender="messageSender"
    			marshaller="processWorkItemCastorMarshaller" unmarshaller="processWorkItemCastorMarshaller">
    		</ws:outbound-gateway>
    		
    	</int:chain>
    	
    		<bean id="messageSender" class="org.springframework.ws.transport.http.CommonsHttpMessageSender" 
    		  p:connectionTimeout="100" p:readTimeout="6000" />
    Code:
    [3/30/12 17:36:49:270 CST] 00000009 TimeoutManage I   WTRN0006W: Transaction 0000013662F50FA700000001000000016F3671EE29A9139E751E73E41CA7001A41546A990000013662F50FA700000001000000016F3671EE29A9139E751E73E41CA7001A41546A9900000001 has timed out after 120 seconds.
    [3/30/12 17:36:49:270 CST] 00000009 TimeoutManage I   WTRN0124I: When the timeout occurred the thread with which the transaction is, or was most recently, associated was Thread[MessageListenerThreadPool : 0,5,main]. The stack trace of this thread when the timeout occurred was: 
    	sun.misc.Unsafe.park(Native Method)
    	java.util.concurrent.locks.LockSupport.park(LockSupport.java:173)
    	java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:758)
    	java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:916)
    	java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1228)
    	java.util.concurrent.CountDownLatch.await(CountDownLatch.java:218)
    	org.springframework.integration.core.MessagingTemplate$TemporaryReplyChannel.receive(MessagingTemplate.java:378)
    	org.springframework.integration.core.MessagingTemplate$TemporaryReplyChannel.receive(MessagingTemplate.java:372)
    	org.springframework.integration.core.MessagingTemplate.doReceive(MessagingTemplate.java:301)
    	org.springframework.integration.core.MessagingTemplate.doSendAndReceive(MessagingTemplate.java:319)
    	org.springframework.integration.core.MessagingTemplate.sendAndReceive(MessagingTemplate.java:239)
    	org.springframework.integration.core.MessagingTemplate.convertSendAndReceive(MessagingTemplate.java:274)
    	org.springframework.integration.gateway.MessagingGatewaySupport.doSendAndReceive(MessagingGatewaySupport.java:165)
    	org.springframework.integration.gateway.MessagingGatewaySupport.sendAndReceive(MessagingGatewaySupport.java:143)
    	org.springframework.integration.gateway.GatewayProxyFactoryBean.invokeGatewayMethod(GatewayProxyFactoryBean.java:300)
    	org.springframework.integration.gateway.GatewayProxyFactoryBean.doInvoke(GatewayProxyFactoryBean.java:269)
    	org.springframework.integration.gateway.GatewayProxyFactoryBean.invoke(GatewayProxyFactoryBean.java:260)
    	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    	org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    	$Proxy28.createBPMWorkItem(Unknown Source)

  8. #8
    Join Date
    Jan 2009
    Location
    Ukraine, Kharkov
    Posts
    632

    Default

    Show more stackTrace, please.
    I think the problem is is lying somewhere above, not in <ws:outbound-gateway>...

  9. #9

    Default

    Hi,
    Below is the full stack trace.
    Code:
    [3/30/12 18:20:58:017 CST] 0000000c WorkSpaceMana A   WKSP0500I: Workspace configuration consistency check is disabled.
    [3/30/12 18:22:52:891 CST] 0000001d TimeoutManage I   WTRN0006W: Transaction 00000136631F3B0C00000004000000016F3671EE29A9139E751E73E41CA7001A41546A9900000136631F3B0C00000004000000016F3671EE29A9139E751E73E41CA7001A41546A9900000001 has timed out after 120 seconds.
    [3/30/12 18:22:52:891 CST] 0000001d TimeoutManage I   WTRN0124I: When the timeout occurred the thread with which the transaction is, or was most recently, associated was Thread[MessageListenerThreadPool : 0,5,main]. The stack trace of this thread when the timeout occurred was: 
    	sun.misc.Unsafe.park(Native Method)
    	java.util.concurrent.locks.LockSupport.park(LockSupport.java:173)
    	java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:758)
    	java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:916)
    	java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1228)
    	java.util.concurrent.CountDownLatch.await(CountDownLatch.java:218)
    	org.springframework.integration.core.MessagingTemplate$TemporaryReplyChannel.receive(MessagingTemplate.java:378)
    	org.springframework.integration.core.MessagingTemplate$TemporaryReplyChannel.receive(MessagingTemplate.java:372)
    	org.springframework.integration.core.MessagingTemplate.doReceive(MessagingTemplate.java:301)
    	org.springframework.integration.core.MessagingTemplate.doSendAndReceive(MessagingTemplate.java:319)
    	org.springframework.integration.core.MessagingTemplate.sendAndReceive(MessagingTemplate.java:239)
    	org.springframework.integration.core.MessagingTemplate.convertSendAndReceive(MessagingTemplate.java:274)
    	org.springframework.integration.gateway.MessagingGatewaySupport.doSendAndReceive(MessagingGatewaySupport.java:165)
    	org.springframework.integration.gateway.MessagingGatewaySupport.sendAndReceive(MessagingGatewaySupport.java:143)
    	org.springframework.integration.gateway.GatewayProxyFactoryBean.invokeGatewayMethod(GatewayProxyFactoryBean.java:300)
    	org.springframework.integration.gateway.GatewayProxyFactoryBean.doInvoke(GatewayProxyFactoryBean.java:269)
    	org.springframework.integration.gateway.GatewayProxyFactoryBean.invoke(GatewayProxyFactoryBean.java:260)
    	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    	org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    	$Proxy28.createBPMWorkItem(Unknown Source)
    	com.hsbc.mpfbpm.integration.jms.listener.MPFMDBListener$1.doInJms(MPFMDBListener.java:142)
    	com.hsbc.esf.jms.templates.MessengerSessionCallback.doInJms(MessengerSessionCallback.java:43)
    	org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:466)
    	com.hsbc.esf.jms.templates.ESJmsTemplate.execute(ESJmsTemplate.java:49)
    	com.hsbc.mpfbpm.integration.jms.listener.MPFMDBListener.processMessage(MPFMDBListener.java:109)
    	com.hsbc.esf.jms.async.templates.EsMessageListener.onMessage(EsMessageListener.java:96)
    	com.hsbc.esf.jms.async.impl.EsMessageDrivenBean.onMessage(EsMessageDrivenBean.java:107)
    	com.ibm.ejs.jms.listener.MDBWrapper$PriviledgedOnMessage.run(MDBWrapper.java:302)
    	com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:63)
    	com.ibm.ejs.jms.listener.MDBWrapper.callOnMessage(MDBWrapper.java:271)
    	com.ibm.ejs.jms.listener.MDBWrapper.onMessage(MDBWrapper.java:240)
    	com.ibm.mq.jms.MQSession$FacadeMessageListener.onMessage(MQSession.java:147)
    	com.ibm.msg.client.jms.internal.JmsSessionImpl.run(JmsSessionImpl.java:2557)
    	com.ibm.mq.jms.MQSession.run(MQSession.java:860)
    	com.ibm.ejs.jms.JMSSessionHandle.run(JMSSessionHandle.java:975)
    	com.ibm.ejs.jms.listener.ServerSession.connectionConsumerOnMessage(ServerSession.java:900)
    	com.ibm.ejs.jms.listener.ServerSession.onMessage(ServerSession.java:665)
    	com.ibm.ejs.jms.listener.ServerSession.dispatch(ServerSession.java:632)
    	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
    	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
    	java.lang.reflect.Method.invoke(Method.java:599)
    	com.ibm.ejs.jms.listener.ServerSessionDispatcher.dispatch(ServerSessionDispatcher.java:37)
    	com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:96)
    	com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:132)
    	com.ibm.ejs.jms.listener.ServerSession.run(ServerSession.java:496)
    	com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527)

  10. #10
    Join Date
    Jan 2009
    Location
    Ukraine, Kharkov
    Posts
    632

    Default

    So, as I understand you invoke some Gateway:
    $Proxy28.createBPMWorkItem(Unknown Source)
    com.hsbc.mpfbpm.integration.jms.listener.MPFMDBLis tener$1.doInJms(MPFMDBListener.java:142)
    And it is waiting reply in the:
    org.springframework.integration.core.MessagingTemp late$TemporaryReplyChannel.receive(MessagingTempla te.java:378)
    But your gateway message flow doesn't returnt anything.
    Who sends message to the mpfBpmNotificationChannel? And who is subscribed to the wsInChannel ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •