crystalcoraldsouza / google-api-translate-java

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

Error retrieving translation #151

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I'm trying to run the following code

public class TranslateMain 
{
    public static void main(String[] args) throws Exception {
        // Set the HTTP referrer to your website address.
        Translate.setHttpReferrer("http://www.google.co.in/");

        String translatedText = Translate.execute("Bonjour le monde",
                Language.FRENCH, Language.ENGLISH);

        System.out.println(translatedText);
      }

}

im getting the following exception

xception in thread "main" java.lang.Exception: [google-api-translate-java] 
Error retrieving translation.
    at com.google.api.GoogleAPI.retrieveJSON(GoogleAPI.java:136)
    at com.google.api.translate.Translate.execute(Translate.java:69)
    at TranslateMain.main(TranslateMain.java:10)
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:516)
    at java.net.Socket.connect(Socket.java:466)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:365)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:477)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:214)
    at sun.net.www.http.HttpClient.New(HttpClient.java:287)
    at sun.net.www.http.HttpClient.New(HttpClient.java:299)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:796)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:748)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:673)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:840)
    at com.google.api.GoogleAPI.retrieveJSON(GoogleAPI.java:115)
    ... 2 more

Original issue reported on code.google.com by suren.1...@gmail.com on 29 Sep 2011 at 10:58

GoogleCodeExporter commented 8 years ago
Seems like a local network problem.

Original comment by rich.mid...@gmail.com on 5 Nov 2011 at 5:22