Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

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

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone, I'm new to this forum.
I have successful design a java program that read stock exchange, from google, which I found how to do it online.
Here is the link to the video

I did put the google finance website in a loop, which checks it over and over to ensure that the stock is current

Everything works fine until after it loops over a thousand times, which I guess google sense it as a bot and denies me access, and then it throws this error:
Exception in thread "main" java.io.IOException: Server returned HTTP response code: 503 for URL: https://ipv4.google.com/sorry/index?continue=https://www.google.com/finance%3Fq%3DEURUSD%26ei%3DDck0WZHIAtaXeYOonJgH&q=EgS4quCrGLHm18kFIhkA8aeDS7wPSBKIVUgKVUJ9SmmbXeLbDdVOMgNyY24
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1876)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at xchange.Xchange.main(Xchange.java:78)
C:\Users\Administrator\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 7 minutes 1 second)

How can I solve this?
Thanks in advance
 
author
Posts: 23853
141
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Sarki Amada wrote:
Everything works fine until after it loops over a thousand times, which I guess google sense it as a bot and denies me access.

How can I solve this?



Well, I would recommend doing some research on Financial APIs. Perhaps, there are ones that can provide the quality of service that you need, and for a reasonable price.

Henry
 
Ranch Hand
Posts: 230
1
jQuery Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sarki, Welcome to Ranch. Did you try debug first with some lots familiar data if the code still under testing ? So that we can narrow down to cause of issue. Try with a google produced file.
 
Mohammed Sardar.
Ranch Hand
Posts: 230
1
jQuery Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


It may give you some more ideas to you.

HTTP 503 means Requested Service is Unavailable.

It might be due to,

1) Server might be busy

2) Server might be down for maintenance

If you are accessing a service and getting this error, then try to contact the service owner to find out what's going on. If you are the owner of the service, then check the errors in the log to find out the problem.

If you are just making lot's of connections to the service from client class, and getting this error, then you need to think about why you need to create so many connections.
 
Sarki Amada
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the server is not busy and isn't down for maintenance because I open the link on browser it works fine, and if I connect to another wifi, the program works until the looping reaches a thousand plus and then it will throw the error, I read on other website that other user posted with similar problem, it's being said that it maybe because the connection is coming from a java program and not a browser that's why google denies the connection to continue, so is their any way to solve it, some people point out to use user agent, to trick google that you're coming from a browser, but truthfully I don't know how to implement that. in my code

Mohammed Sardar. wrote:

It may give you some more ideas to you.

HTTP 503 means Requested Service is Unavailable.

It might be due to,

1) Server might be busy

2) Server might be down for maintenance

If you are accessing a service and getting this error, then try to contact the service owner to find out what's going on. If you are the owner of the service, then check the errors in the log to find out the problem.

If you are just making lot's of connections to the service from client class, and getting this error, then you need to think about why you need to create so many connections.

 
Rancher
Posts: 4450
47
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you open that page?

This is what it says:


So yes, they monitor connections.
If your browser did the same thing (eg using Javascript) it would probably respond the same way.
 
Sarki Amada
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dave, how did you get the system to report that result to you??

Dave Tolls wrote:Did you open that page?
This is what it says:


So yes, they monitor connections.
If your browser did the same thing (eg using Javascript) it would probably respond the same way.

 
Dave Tolls
Rancher
Posts: 4450
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exception you posted said:

Exception in thread "main" java.io.IOException: Server returned HTTP response code: 503 for
URL: https://ipv4.google.com/sorry/index?continue=https://www.google.com/finance%3Fq%3DEURUSD%26ei%3DDck0WZHIAtaXeYOonJgH&q=EgS4quCrGLHm18kFIhkA8aeDS7wPSBKIVUgKVUJ9SmmbXeLbDdVOMgNyY24

So I just copied that URL and pasted it into the browser...
 
Remember to always leap before you look. But always take the time to smell the tiny ads:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!