views:

617

answers:

4
Loading classifier from D:\PROJECT\classifiers\NERDemo\classifiers\ner-eng-ie.crf-3-all2008.ser.gz ... done [2.0 sec].
Original Query was riot in India.
Parsing Queries and expanding tokens from the Ontologies..
{locations=[India], events=[riot]}
Search query is null
Something went wrong...

java.net.UnknownHostException: ajax.googleapis.com
 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)
 at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
 at org.girs2.SearchHandler.makeQuery(SearchHandler.java:35)
 at org.girs2.GIRS.search(GIRS.java:37)
 at org.girs2.GIRS.main(GIRS.java:62)
Exception in thread "main" java.lang.NullPointerException
 at org.girs2.GIRS.search(GIRS.java:44)
 at org.girs2.GIRS.main(GIRS.java:62)
+1  A: 

Looks like you probably have or had a DNS lookup failure. This tells you what happened:

java.net.UnknownHostException: ajax.googleapis.com

If you always get this exception and you can otherwise access this host by name, then I don't know what this could be, but odds are that this was a temporary DNS failure.

What should you do when you get this Exception? Well, if the address is one that you fully expect you should be able to get to -- such as this one -- then when you catch the Exception, you sleep for a while (perhaps 10 or 15 seconds, maybe even 30 or 60 seconds, depending on your application's needs) and try again.

If after several retries -- don't just retry forever! -- you still cannot reach the site, then log a reasonable complaint or otherwise complain that you cannot reach the site and have your application exit.

There's not much you can do when DNS fails except give up or wait and try again.

Eddie
thanks but how do i handle it?
I updated my answer to respond.
Eddie
A: 

probably you're behind a firewall.
Try to connect to ajax.googleapis.com, something like

    ping ajax.googleapis.com

do you get an IP-Number, something like 74.125.77.95?
do you get some server reply?

Added:
If none works,try http://ajax.googleapis.com/ on your browser.

If it don't work (showing Google page), your connection to the network is broken: no connection to DNS or to the site.

If it works, you're probably behind a firewall, you'll need a proxy. Get the proxy settings (host and port) from your browser and use them to run your application: see Chapter 2.1

Carlos Heuberger
I tried using tat ping..but,couldnt get it..the error I get isPing request could not find host ajax.googleapis.com. Please check the name andtry again.
just another point: maybe you're only *missing* the DNS.also try "ping 74.125.77.05" please...
Carlos Heuberger
A: 

hi friends......

i am also getting the same kind of exception but with a different url.......instead of "ajax.googleapis.com" am using "search.yahooapis.com"

i tried in in home....my application is working perfectly....but when am trying it in my college its showing the same exception above........can any one try to help me in solving this problem?????

thanks in regardsssss.........

I would say that is a configuration problem: a firewall and/or missing the nameserver. If you can access the internet using a browser, you can try using the proxy configured of the browser. See also: http://java.sun.com/javase/6/docs/technotes/guides/net/proxies.html
Carlos Heuberger
A: 

I am working on text to text translation and using google APIs. Each time i run the code, it gives me the error:-

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 speechdemo.TextToText.main(TextToText.java:42)
Caused by: java.net.UnknownHostException: ajax.googleapis.com
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:525)
    at java.net.Socket.connect(Socket.java:475)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
    at sun.net.www.http.HttpClient.New(HttpClient.java:306)
    at sun.net.www.http.HttpClient.New(HttpClient.java:323)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:860)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:801)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:726)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:904)
    at com.google.api.GoogleAPI.retrieveJSON(GoogleAPI.java:107)

I've tried to ping 74.125.77.95 and got the reply :- Ping statistics for 74.125.77.5: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

Kindly help me out with these errors.

Anurag