【问题标题】:Jersey REST service throw Timeout exceptionJersey REST 服务抛出超时异常
【发布时间】:2018-01-23 15:18:29
【问题描述】:

我们有一个 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)

我不确定问题出在哪里,是服务器超时还是客户端超时?如果是客户端问题,我可以添加重试,但是如果是服务器超时怎么办?

【问题讨论】:

    标签: java rest jersey spring-rest


    【解决方案1】:

    错误Connection timed out: 表示您的请求在特定时间或时间段内没有得到响应。我们的响应机器人在时间段内超时的原因有很多:

    1) 可能是ip地址或端口不正确。

    2) 可能是ip地址已关闭。

    3) 您的服务器或主机花费的时间超过您指定的超时时间。

    4) 可能是服务器或主机的防火墙阻止了您正在使用的请求或端口。

    5) 互联网访问或本地网络问题或连接。

    6) 由于错误的网络配置或流量过载导致的丢包。

    c) 主机或服务器上出现过多请求的过载问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-10
      • 1970-01-01
      • 1970-01-01
      • 2015-07-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多