jenkinsci / jenkinsci/java-client-api

java.net.UnknownHostException: build: nodename nor servname provided, or not known

Open
#314 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
913
Forks
466
PR merge metrics
No merged PRs in 30d

Description

Tried simple code from the example:

`Map jobs = null;
try {
jobs = jenkins.getJobs();
System.out.println(jobs.keySet());
JobWithDetails ios = jobs.get("My job").details();
} catch (IOException e) {
e.printStackTrace();
}`

Fails with:
`java.net.UnknownHostException: build: nodename nor servname provided, or not known
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
at java.net.InetAddress.getAllByName(InetAddress.java:1192)
at java.net.InetAddress.getAllByName(InetAddress.java:1126)
at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:44)
at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:102)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:319)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at com.offbytwo.jenkins.client.JenkinsHttpClient.get(JenkinsHttpClient.java:134)
at com.offbytwo.jenkins.model.Job.details(Job.java:45)
at Jenkins.main(Jenkins.java:26)`

Tried to google, found out several similar issues, like [this](http://crunchify.com/getting-java-net-unknownhostexception-nodename-nor-servname-provided-or-not-known-error-on-mac-os-x-update-your-privateetchosts-file/). But **build** is not my hostname and even if I add it to /etc/hosts, this code won't run anyway.

Any idea how to fix this?

macos 10.13.1
java 1.8.0_141

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.