简体   繁体   English

Jersey REST服务抛出超时异常

[英]Jersey REST service throw Timeout exception

we have a Jersey REST service, and REST client using Spring's REST template, once in a while we noticed the client got 500 Internal Server Error from the REST service: 我们有一个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

when checking the server's log we found this: 在检查服务器日志时,我们发现:

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)

I'm not sure what the problem is here, is the server timeout or the client got timeout? 我不确定这是什么问题,是服务器超时还是客户端超时? If it's client issue, i can add retry, but what to do if it's server timeout? 如果是客户端问题,我可以添加重试,但是如果服务器超时怎么办?

The error Connection timed out : means that your request did not get a response within the specific time or in time period. 错误Connection timed out :表示您的请求在特定时间或特定时间段内未得到响应。 and there is many reasons for time out our response bot get in time period: 而且我们的响应机器人超时的原因有很多:

1) may be ip address or port is incorrect. 1)可能是IP地址或端口不正确。

2) may be ip address is down. 2)可能是ip地址被关闭了。

3) you server or host is taking longer or more time than your specify time for timeout. 3)您的服务器或主机花费的时间比您指定的超时时间更长或更长时间。

4) may be firewall of server or host blocking the requests or port which you are using. 4)可能是服务器或主机的防火墙阻止了您正在使用的请求或端口。

5) internet access or local network issue or connectivity. 5)互联网访问或本地网络问题或连接。

6) packet loss due to wrong network configuration or traffic overload. 6)由于错误的网络配置或流量过载造成的数据包丢失。

c) overloading of too many requests issue at host or server . c)主机或服务器上发出过多的请求而导致超载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM