线程" main"中的例外情况java.net.UnknownHostException:api.opencalais.com

时间:2014-07-14 07:28:51

标签: java opencalais

运行程序时出现Opencalasis.com错误。

请检查以下程序告诉我这是否有任何错误。

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.");



    }

}

我添加了guava jar和jackson jar的jackson-mapper-asl&杰克逊芯-ASL。

错误是这样的:

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

1 个答案:

答案 0 :(得分:1)

API.opencalais.com在撰写本文时作出回应。所以,要么:

  • 您未连接到互联网
  • 防火墙阻止您的连接
  • 您有DNS问题

您可以使用常用的命令行工具诊断所有这些工具,ping和dig。