title: Getting ConnectionTimeoutException with the host did not accept the connection within timeout
body: <p>Can Some one Help me, how we can solve the following problem.</p>
  
  <pre><code>nested
  exception is org.apache.commons.httpclient.ConnectTimeoutException: The host did
  not accept the connection within timeout of 10000 ms
          at
  org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.convertHttpInvokerAccessException(HttpInvokerClientInterceptor.java:211)
          at
  org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:144)
          at
  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
          at
  org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
          at $Proxy19.isEmployeeToken(Unknown Source)
          at
  com.clickandbuy.webapps.surfer.commons.ContextUtils.isEmployeeToken(ContextUtils.java:375)
          at
  com.clickandbuy.webapps.surfer.commons.ContextUtils.validateLogin(ContextUtils.java:248)
          at sun.reflect.GeneratedMethodAccessor1364.invoke(Unknown Source)
          at
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
          at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:274)
          at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
          at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
          at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
          at
  org.springframework.binding.expression.el.BindingValueExpression.getValue(BindingValueExpression.java:54)
          at
  org.springframework.binding.expression.el.ELExpression.getValue(ELExpression.java:54)
          at
  org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:77)
          at
  org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)
          at
  org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145)
          at
  org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51)
          at
  org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:101)
          at org.springframework.webflow.engine.State.enter(State.java:194)
          at org.springframework.webflow.engine.Flow.start(Flow.java:535)
          at
  org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:364)
          at
  org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:222)
          at
  org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:140)
          at
  org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:193)
          at
  org.springframework.webflow.mvc.servlet.FlowController.handleRequest(FlowController.java:174)
          at
  org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
          at
  org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
          at
  org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
          at
  org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
          at
  org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
          at
  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
          at
  org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at
  com.clickandbuy.webapps.surfer.commons.filter.LogUserIPFilter.doFilter(LogUserIPFilter.java:61)
          at
  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at
  org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at
  com.clickandbuy.webapps.surfer.commons.filter.AddHeaderFilter.doFilter(AddHeaderFilter.java:54)
          at
  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at
  org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at
  com.clickandbuy.webapps.commons.filter.SessionSizeFilter.doFilter(SessionSizeFilter.java:76)
          at
  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at
  org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at
  org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
          at
  org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
          at
  org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
          at
  org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
          at
  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
          at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568)
          at
  org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at
  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
          at
  org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
          at
  org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
          at java.lang.Thread.run(Thread.java:619)
  Caused by: org.apache.commons.httpclient.ConnectTimeoutException: The host did
  not accept the connection within timeout of 10000 ms
          at
  org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:155)
          at
  org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:125)
          at
  org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
          at
  org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
          at
  org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
          at
  org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
          at
  org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
          at
  org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
          at
  org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor.executePostMethod(CommonsHttpInvokerRequestExecutor.java:195)
          at
  org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor.doExecuteRequest(CommonsHttpInvokerRequestExecutor.java:129)
          at
  org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor.executeRequest(AbstractHttpInvokerRequestExecutor.java:136)
          at
  org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.executeRequest(HttpInvokerClientInterceptor.java:191)
          at
  org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.executeRequest(HttpInvokerClientInterceptor.java:173)
          at
  org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:141)
          ... 57 more
  Caused by: java.net.SocketTimeoutException: connect timed out
          at java.net.PlainSocketImpl.socketConnect(Native Method)
          at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
          at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
          at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
          at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
          at java.net.Socket.connect(Socket.java:519)
          at sun.reflect.GeneratedMethodAccessor284.invoke(Unknown Source)
          at
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at
  org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:140)
          ... 70 more
  </code></pre>
  
  <p>My confiugration is as follows....</p>
  
  <pre><code>&lt;bean id="loginManagerHttpInvoker" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean"&gt;
          &lt;property name="serviceUrl" value="service url" /&gt;
          &lt;property name="serviceInterface" value="service interface" /&gt;
          &lt;property name="httpInvokerRequestExecutor"&gt;
              &lt;bean class="org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor"&gt;
                  &lt;property name="httpClient"&gt;
                      &lt;bean class="org.apache.commons.httpclient.HttpClient"&gt;
                          &lt;property name="httpConnectionManager"&gt;
                              &lt;bean class="org.apache.commons.httpclient.MultiThreadedHttpConnectionManager"&gt;
                                  &lt;property name="params"&gt;
                                      &lt;bean class="org.apache.commons.httpclient.params.HttpConnectionManagerParams"&gt;
                                          &lt;property name="connectionTimeout"&gt;&lt;value&gt;10000&lt;/value&gt;&lt;/property&gt;
                                          &lt;property name="defaultMaxConnectionsPerHost"&gt;&lt;value&gt;150&lt;/value&gt;&lt;/property&gt;
                                          &lt;property name="maxTotalConnections"&gt;&lt;value&gt;150&lt;/value&gt;&lt;/property&gt;
                                          &lt;property name="staleCheckingEnabled" value="true" /&gt;
                                          &lt;property name="linger" value="-1" /&gt;
                                          &lt;property name="soTimeout"&gt;&lt;value&gt;60000&lt;/value&gt;&lt;/property&gt;
                                      &lt;/bean&gt;
                                  &lt;/property&gt;
                              &lt;/bean&gt;
                          &lt;/property&gt;
                      &lt;/bean&gt;
                  &lt;/property&gt;
              &lt;/bean&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  </code></pre>
  
  <p>After the server restart everything is working fine. And I could able to connect to server. What could be the problem, It happend only one time, I have never seen this before... Same configuration nothing changed....</p>
  
  <p>Thanks In Advance</p>
  
  <p>Sanjana</p>