java.io.IOException:服务器返回 HTTP 响应代码:502

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20028626/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 22:27:43  来源:igfitidea点击:

java.io.IOException: Server returned HTTP response code: 502

javaexception-handling

提问by Ashfaq

i wrote a code which goes to a list of web addresses and get data from there. but when i run code some time code works mean goes to all web links and take data but some time i goes to 2 or 4 websites and get data and after them gives this exception followed by a web link form list.

我写了一个代码,它转到一个网址列表并从那里获取数据。但是当我运行代码时,有时代码工作意味着转到所有网络链接并获取数据,但有时我会转到 2 或 4 个网站并获取数据,然后在它们之后给出此异常,然后是网络链接表单列表。

java.io.IOException: Server returned HTTP response code: 502

java.io.IOException:服务器返回 HTTP 响应代码:502

but actually web link is alive not dead. when i run code for 2nd time then it runs but gives this exception for another link. code is too long thats why not posting it. if needed i can provide.

但实际上网页链接还活着而不是死了。当我第二次运行代码时,它会运行但为另一个链接提供此异常。代码太长这就是为什么不发布它。如果需要我可以提供。

Whats this excetption about?

这是什么异常?

采纳答案by Paul Draper

502 means "Bad Gateway". See http://www.checkupdown.com/status/E502.html.

502 的意思是“坏网关”。请参阅http://www.checkupdown.com/status/E502.html

The server the Java client is talking to is the "gateway". That server was depending on another server (called the "upstream" server) to give it a response and it failed.

Java 客户端与之通信的服务器是“网关”。该服务器依赖于另一台服务器(称为“上游”服务器)来给它一个响应,但它失败了。

In my experience, 502 errors are sporadic, and can indicate problems with server architecture.

根据我的经验,502 错误是偶发的,可能表示服务器架构存在问题。