Search code examples
javaopencalais

Exception in thread "main" java.net.UnknownHostException: api.opencalais.com


I am getting an Opencalasis.com error while running a program.

Please check below program tell me whether we are doing any mistake in this.

package org.com.sample.jcalasis;

import java.io.IOException;

import mx.bigdata.jcalais.CalaisClient;
import mx.bigdata.jcalais.CalaisObject;
import mx.bigdata.jcalais.CalaisResponse;
import mx.bigdata.jcalais.rest.CalaisRestClient;

public class Demo {

    /**
     * @param args
     * @throws IOException 
     */
    public static void main(String[] args) throws IOException {

        CalaisClient client = new CalaisRestClient("OpenCalais API key");
        CalaisResponse response = client.analyze("Prosecutors at the trial of former Liberian President Charles Taylor " 
               + " hope the testimony of supermodel Naomi Campbell " 
               + " will link Taylor to the trade in illegal conflict diamonds, "
               + " which they say he used to fund a bloody civil war in Sierra Leone.");



    }

}

I have added the guava jar and jackson jar of jackson-mapper-asl & jackson-core-asl.

Error was like this :

Exception in thread "main" java.net.UnknownHostException: api.opencalais.com

Solution

  • API.opencalais.com responds as of this writing. So, either:

    • you are not connected to the Internet
    • a firewall blocks your connection
    • you have a DNS issue

    You can diagnose all of these with the usual command line tools, ping and dig.