奇怪的java.io.IOException:服务器返回HTTP响应代码:503的URL [英] Weird java.io.IOException: Server returned HTTP response code: 503 for URL
问题描述
我正在Glassfish下编写一个servlet jsp,从网站下载文件,做一些处理并在网页中显示结果。
当我部署servlet时,会出现以下错误:
java.io.IOException:服务器返回HTTP响应代码:503 for
URL:www.websitename.com错误。
我检查503状态码,结果是服务器过载指示器。
然而,如果我编写一个独立的程序,访问同一个网站,它可以正常工作。
IOException的原因是什么?
I尝试使用HttpClient(不需要其他配置),并且一切正常。尽管如此,我仍然不知道HttpClient的工作原理,但是如果你有类似的问题,它绝对是一种尝试的方式。
I am writing a servlet jsp under Glassfish to download a file from a website, do some processing and display the result in webpage.
When I deploy the servlet, it get this error :
java.io.IOException: Server returned HTTP response code: 503 for
URL: www.websitename.com error.
I check the status code 503 out and it turns out to be a server overload indicator.
However, if I write a standalone program, accessing the same website, it works fine.
What can be the reason of the IOException?
I tried it using HttpClient (no other configuration needed), and everything works fine. Still I have no idea why HttpClient works, but it's definitely a way to try out if you have similar problem.
这篇关于奇怪的java.io.IOException:服务器返回HTTP响应代码:503的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!