| Author |
Google language translation API
|
kandarp mehta
Greenhorn
Joined: May 04, 2010
Posts: 6
|
|
I am using Google Transalation API to convert String from one language to another. I have already set Translate.setHttpHeader() value, then also it gives below exception.
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 com.nextenders.client.beans.ruleengine.RuleEngineTest.main(RuleEngineTest.java:27)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.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)
null
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
at com.google.api.GoogleAPI.retrieveJSON(GoogleAPI.java:107)
... 2 more
Anybody know solution of this exception? Or anybody knows any API which convert from one language to another in java?
|
 |
James Elsey
Ranch Hand
Joined: Dec 21, 2007
Posts: 228
|
|
Is there anything else in the stack trace?
I did a quick google on the exception your getting, a few of them have had a "caused by" then a URL, does your stack trace have that?
Have a look here, it is a quick tutorial and several people have posted regarding the error : http://www.techiegyan.com/?p=279
Also, it would probably be worth the investment to get the google API working, since their translation service is quite good. Maybe Yahoo or BabelFish provide something similar..
|
Kind Regards, James. OCPJP 1.6 || My SCJP / OCJCP Study Notes
Interested in : SCJP, Google App Engine, Stripes, Android;|| My Bite-Size SCJP Study Blog
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
You can't connect to the service, plain and simple. Try to find out to what host and port the service is trying to connect, then try connecting using telnet:
- open a Command Prompt
- type in "telnet HOST PORT" where HOST and PORT are the Google API host and port. For instance, "telnet www.google.com 80" to test Google's website.
If you can also not connect this way then you should check your firewall, or contact your system administrator.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12928
|
|
You've also asked the same question on StackOverflow: http://stackoverflow.com/questions/2780688/language-translation-api
Please BeForthrightWhenCrossPostingToOtherSites
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: Google language translation API
|
|
|