CXF Read timed out

This exception happens, when invoking the client and it takes 50-60 seconds after that  we get Read timed out, following are the stacktrace

Caused by: org.apache.cxf.interceptor.Fault: Could not send Message.
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
at org.apache.cxf.endpoint.ClientImpl.invoke(
at org.apache.cxf.endpoint.ClientImpl.invoke(
at org.apache.cxf.frontend.ClientProxy.invokeSync(
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(
... 26 more
Caused by: Read timed out
at Method)

This article explains about how to fix this exception in CXF way


For running this client you need to refer the classes created on CXF Web Service Tutorial. This client is created for above service.

Required Libraries

You need to download following libraries in order to Generate CXF Client

  1. JDK 6
  2. Eclipse 3.7
  3. CXF-2.7.3
  4. Tomcat 7 (Deploying Web Service)

Following jar must be in classpath

  1. commons-logging-1.1.1.jar
  2. cxf-2.7.3.jar
  3. httpasyncclient-4.0-beta3.jar
  4. httpclient-4.2.1.jar
  5. httpcore-4.2.2.jar
  6. httpcore-nio-4.2.2.jar
  7. neethi-3.0.2.jar
  8. spring-aop-3.0.7.RELEASE.jar
  9. spring-asm-3.0.7.RELEASE.jar
  10. spring-beans-3.0.7.RELEASE.jar
  11. spring-context-3.0.7.RELEASE.jar
  12. spring-core-3.0.7.RELEASE.jar
  13. spring-expression-3.0.7.RELEASE.jar
  14. spring-web-3.0.7.RELEASE.jar
  15. wsdl4j-1.6.2.jar
  16. xmlschema-core-2.0.3.jar

Fix Read timed out exception

You can use HTTPConduit and HTTPClientPolicy and need to set ConnectionTimeout and ReceiveTimeout when invoking the service, please see the below code


Here we are using CXF's JaxWsProxyFactoryBean, if you need to set timeout in JAX-WS way, you can set request timeout on request context property. See the code below
java.util.Map requestContext =(( port).getRequestContext();
requestContext.put(, new Long(600000));

1 2 Next

Your email address will not be published. Required fields are marked *