anupam409 / google-api-translate-java

Automatically exported from code.google.com/p/google-api-translate-java
0 stars 0 forks source link

unalble to retrive the translation #108

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
java.lang.Exception: [google-api-translate-java] Error retrieving translation.
        at com.google.api.GoogleAPI.retrieveJSON(GoogleAPI.java:123)
        at com.google.api.translate.Translate.execute(Translate.java:69)
        at dbUtil.DbUtil.trans(DbUtil.java:72)
        at net.Main.main(Main.java:31)
Caused by: java.net.ConnectException: Connection timed out: connect
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
        at java.net.Socket.connect(Socket.java:520)
        at java.net.Socket.connect(Socket.java:470)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:388)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:523)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:231)
        at sun.net.www.http.HttpClient.New(HttpClient.java:304)
        at sun.net.www.http.HttpClient.New(HttpClient.java:321)
        at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:813)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:765)
        at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:690)
        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:857)
        at com.google.api.GoogleAPI.retrieveJSON(GoogleAPI.java:107)
        ... 3 more

I also want to know if the "setHttpReferrer" plays a role in this issue.iI am 
trying to access this api in plain java application and it was working fine for 
first few times but then it started giving the above error.

Original issue reported on code.google.com by ranjeetw...@gmail.com on 4 Nov 2010 at 6:27

GoogleCodeExporter commented 9 years ago
Solved it :
use the lines to pass the proxy:

System.getProperties().put("proxySet", "true");
System.getProperties().put("proxyHost", "170.1.0.10");
System.getProperties().put("proxyPort", "8281");

Original comment by ranjeetw...@gmail.com on 4 Nov 2010 at 6:45

GoogleCodeExporter commented 9 years ago

Original comment by rich.mid...@gmail.com on 6 Nov 2010 at 4:58