chinaej18 / google-api-translate-java

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

java.lang.Exception: [google-api-translate-java] Error retrieving translation. #51

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,
  when i use the google-api-translate-java-0[1].53.jar to translate the 
words from English to other language(in java code) am getting the below 
mentioned error.Please let me know what may be the issue.

Error: 

java.lang.Exception: [google-api-translate-java] Error retrieving 
translation.
    at com.google.api.translate.Translate.retrieveTranslation
(Translate.java:144)
    at com.google.api.translate.Translate.translate(Translate.java:107)
    at src.Main.main(Main.java:11)
Caused by: java.net.UnknownHostException: translate.google.com
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown 
Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown 
Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException
(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream
(Unknown Source)
    at com.google.api.translate.Translate.retrieveTranslation
(Translate.java:140)
    ... 2 more
Caused by: java.net.UnknownHostException: translate.google.com
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at sun.net.NetworkClient.doConnect(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.http.HttpClient.<init>(Unknown Source)
    at sun.net.www.http.HttpClient.New(Unknown Source)
    at sun.net.www.http.HttpClient.New(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient
(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect
(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown 
Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream
(Unknown Source)
    at com.google.api.translate.Translate.retrieveTranslation
(Translate.java:132)
    ... 2 more

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by cnu...@gmail.com on 16 Jun 2009 at 8:47

GoogleCodeExporter commented 8 years ago
Looks like it can't look up the domain name. Presumably you're either not 
connected to 
the internet, your DNS server is down or maybe you're behind a proxy that you 
haven't 
configured.

Original comment by rich.mid...@gmail.com on 19 Jun 2009 at 9:18

GoogleCodeExporter commented 8 years ago
set the appropriate system properties to your java program

System.setProperty("http.proxyHost", "proxy");
System.setProperty("http.proxyPort", "8080");

Make sure you added the google-api-translate-java-0[1].53.jar file in the IDE 
classpath and if your are using Eclipse IDE goto windows->preferences->Network 
connections-> set the proxy and port in Manual Proxy configuration for HTTP 
proxy and SSL proxy.

usha

Original comment by vojjala....@gmail.com on 13 Oct 2010 at 3:19