我们有一个Jersey REST服务,还有使用Spring的REST模板的REST客户端,偶尔我们注意到该客户端从REST服务中收到500 Internal Server Error:
error: 500 Internal Server Error; nested exception is org.springframework.web.client.HttpServerErrorException: 500 Internal Server Error
在检查服务器日志时,我们发现:
org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [ABC] in context with path [] threw exception [javax.ws.rs.ProcessingException: java.net.ConnectException: Connection timed out (Connection timed out)] with root cause
java.net.ConnectException: Connection timed out (Connection timed out)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
我不确定这是什么问题,是服务器超时还是客户端超时?如果是客户端问题,我可以添加重试,但是如果服务器超时怎么办?
最佳答案
错误Connection timed out
:表示您的请求在特定时间或特定时间段内未得到响应。而且造成响应机器人超时的原因有很多:
1)可能是IP地址或端口不正确。
2)可能是IP地址已关闭。
3)您的服务器或主机花费的时间比您指定的超时时间更长或更长时间。
4)可能是服务器或主机的防火墙阻止了您正在使用的请求或端口。
5)互联网访问或本地网络问题或连接。
6)由于错误的网络配置或流量过载造成的数据包丢失。
c)主机或服务器上发出过多的请求而导致超载。