Weird java.io.IOException: Server returned HTTP response code: 503 for URL

丶灬走出姿态 提交于 2019-12-25 06:55:08

问题


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?


回答1:


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.




回答2:


Is Glassfish running on the same server you're running your standalone program from? If not, it's most likely a network connectivity issue on the machine Glassfish is on. Even if both Glassfish and the standalone application is running on the same machine, it's still possible that it's a network configuration issue (e.g., Glassfish isn't configured to use a proxy when you're supposed to).



来源:https://stackoverflow.com/questions/1506722/weird-java-io-ioexception-server-returned-http-response-code-503-for-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!