SonarQube plugin UnknownHostException

Article ID:360027084351
1 minute readKnowledge base

Issue

SonarQube plugin is not working.

The logs shows something similar to:

2019-04-12 13:21:41.205+0000 [id=1747460]   WARNING h.p.s.client.SQProjectResolver#resolve: Error fetching project information
java.net.UnknownHostException: sonarqubehost: Name or service not known
    at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929)
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1324)
    at java.net.InetAddress.getAllByName0(InetAddress.java:1277)
    at java.net.InetAddress.getAllByName(InetAddress.java:1193)
    at java.net.InetAddress.getAllByName(InetAddress.java:1127)
    at com.squareup.okhttp.Dns$1.lookup(Dns.java:39)
    at com.squareup.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:184)
    at com.squareup.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:153)
    at com.squareup.okhttp.internal.http.RouteSelector.next(RouteSelector.java:95)
    at com.squareup.okhttp.internal.http.HttpEngine.createNextConnection(HttpEngine.java:345)
    at com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:328)
    at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:246)
    at com.squareup.okhttp.Call.getResponse(Call.java:276)
    at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:234)
    at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:196)
    at com.squareup.okhttp.Call.execute(Call.java:79)
    at org.sonarqube.ws.client.HttpConnector.doCall(HttpConnector.java:209)
Caused: java.lang.IllegalStateException: Fail to request https://sonarqubehost:9000/api/server/version
    at org.sonarqube.ws.client.HttpConnector.doCall(HttpConnector.java:212)
    at org.sonarqube.ws.client.HttpConnector.get(HttpConnector.java:154)
    at org.sonarqube.ws.client.HttpConnector.call(HttpConnector.java:143)
    at hudson.plugins.sonar.client.HttpClient.getHttp(HttpClient.java:37)
    at hudson.plugins.sonar.client.WsClient.getServerVersion(WsClient.java:82)
    at hudson.plugins.sonar.client.SQProjectResolver.resolve(SQProjectResolver.java:60)
    at hudson.plugins.sonar.action.SonarCacheAction.get(SonarCacheAction.java:76)
    at hudson.plugins.sonar.action.SonarCacheAction.get(SonarCacheAction.java:51)
    at hudson.plugins.sonar.action.SonarProjectActionFactory.createProjectPage(SonarProjectActionFactory.java:118)
    at hudson.plugins.sonar.action.SonarProjectActionFactory.createFor(SonarProjectActionFactory.java:83)
    at hudson.plugins.sonar.action.SonarProjectActionFactory.createFor(SonarProjectActionFactory.java:42)
    at hudson.model.Actionable.createFor(Actionable.java:114)
    at hudson.model.Actionable.getAllActions(Actionable.java:100)

Resolution

Check that the hostname specified is correct in the Global Configuration. See SonarQube plugin for how to do that.