GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
java.net.ProtocolException: Server redirected too many times (20)  XML
Forum Index -> General
Author Message
Bobby Yang



Joined: 10/09/2008 20:02:26
Messages: 4
Offline

Hi,

I am using the java client to resolve timezones and I keep getting a java.net.ProtocolException: Server redirected too many times (20).

Here is a snippet of the stacktrace:

Sep 11, 2008 10:49:41 AM org.geonames.WebService connect
WARNING: problems connecting to geonames server http://ws.geonames.org
java.net.ProtocolException: Server redirected too many times (20)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1182)
at org.geonames.WebService.connect(Unknown Source)
at org.geonames.WebService.timezone(Unknown Source)

I copied some source from WebService.connect into a test case I wrote and was able to pinpoint to line 148 of WebService.java:

conn.setRequestProperty("User-Agent", USER_AGENT);

When I exclude that line from the source I copied into my test case, the problem goes away. I am not sure why setting a request property on the connection would cause such an exception. Is anyone else having the same problem? Can someone tell me if that is a bug on my end and what I need to do to get around it? Ideally I would not have to keep my own renegade copy of WebService.java in my src.
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team