views:

840

answers:

2

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 gave me: 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?

Lily

A: 

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).

Jack Leow
I am working behind proxy, however, the website I am accessing to is behind the same proxy. So theoretically, I don't need any proxy to retrieve the info from the web... I tried setting up the proxy from Glassfish, but doesn't work, either.
Lily
A: 

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.

Lily