Java Code Examples not working | java.net.UnknownHostException

davly182
davly182 Newcomer

Hi,

I just download "Java Code Examples" and I try to run it on my eclipse with

jdk8 and my user/login datascope.

But when I try to run this program I have this error :

java.net.UnknownHostException:
hosted.datascopeapi.reuters.com

On internet explorer I can access to it, but when I ping in windows prompt I have host unknow.

How can I do?

Do I have to ask changes for proxy/dns at my work place?

Please help.

David LY.

Best Answer

  • Gurpreet
    Gurpreet admin
    Answer ✓

    @davly182

    From the description, it looks like your machine is behind a proxy/firewall.

    You will have to modify the DSS sample to allow for the proxy server -- something like:

    HttpHost proxy = new HttpHost(proxy_ip_address, proxy_port);
    httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);

    See Apache HTTP client for more information.

Answers

  • It means your Java application cannot resolve "hosted.datascopeapi.reuters.com" into an IP address. It doesn't mean the address cannot be accessed, it means it cannot be resolved. Can you do a successful resolve from Windows command prompt:

    nslookup hosted.datascopeapi.reuters.com

    ??

    On my machine it returns the IP : 192.165.219.152.

  • davly182
    davly182 Newcomer

    Thanks Lars-at-Addicticks and Gurpreet.

    no IP for the commande, and I'm not administrator of my computer.

    I contacted my workplace to resolve it.

    thanks.