SonarQube Jenkins plugin: Inconsistent server URL

2,754 views
Skip to first unread message

Mikael Gaunin

unread,
Aug 12, 2016, 8:31:08 AM8/12/16
to SonarQube
Hi,

Here the case I meet with
  • Jenkins 1.642.18.3
  • SonarQube plugin 2.4

Seen in jenkins.log file:
Aug 11, 2016 10:55:05 AM hudson.plugins.sonar.client.SQProjectResolver resolve
INFO: Invalid installation name: my-sonar.company.com
Aug 11, 2016 10:55:05 AM hudson.plugins.sonar.client.SQProjectResolver checkServerUrl
WARNING: Inconsistent server URL: 'http://my-sonar.company.com' parsed, 'http://my-sonar.company.com:9000' configured


Extracted from the hudson.plugins.sonar.SonarGlobalConfiguration.xml file :
<hudson.plugins.sonar.SonarGlobalConfiguration plugin="sonar@2.4">
  <installations>
    <hudson.plugins.sonar.SonarInstallation>
      <name>my-sonar.company.com:9000</name>
      <serverUrl>http://my-sonar.company.com:9000</serverUrl>
      <serverVersion>5.1</serverVersion>


I don't understand the behavior, from my point of view, everything is well-configured and before all, Sonar analysis is working fine, so why the message? What did I miss?

As a side note, I fear to upgrade the plugin version; last time I did it, I had to update all the configuration of the jobs referencing SonarQube...

Thanks a lot for your help
Mikael

Scott B.

unread,
Aug 12, 2016, 9:31:45 AM8/12/16
to SonarQube
Hi.

If I recall correctly, one of these URLs is the "Server base URL" in the SonarQube config. Review this configuration in http://my-sonar.company.com:9000/settings or the sonar.core.serverBaseURL property in your sonar.properties in the server.

aher...@cloudbees.com

unread,
Oct 21, 2016, 10:35:11 AM10/21/16
to SonarQube
Hi all,

I continue to investigate on this issue. Before we had

```
WARNING: Inconsistent server URL: 'http://my-sonar.company.com' parsed, 'http://my-sonar.company.com:9000' configured 
```

But now you have

```
WARNING: Inconsistent server URL: 'http://my-sonar.company.com:9000' parsed, 'http://my-sonar.company.com' configured
```

In the Jenkins / Sonar plugin side we touched to nothing for the configuration we just upgraded from 2.4.0 to 2.4.4.

```
      <serverUrl>http://my-sonar.company.com:9000</serverUrl>
```

In Sonar Server side we changed the serverBaseURL from http://my-sonar.company.com to http://my-sonar.company.com:9000

I really don't understand what this control does and why it is failing. The code which is generating this error is


It compares the server URL computed from the project URL and the one from the plugin Configuration ?

I see nowhere a reference to http://my-sonar.company.com (without port) to understand where this url misconfiguration comes from.

Can you detail more how this control is working please ?

Duarte Meneses

unread,
Oct 25, 2016, 8:37:21 AM10/25/16
to SonarQube, aher...@cloudbees.com
Hi,

The server URL (among other information) is fetched from the "report-task.txt" which is written during the analysis. This information will be used to fetch the projects quality gate and the compute engine task status to be displayed in the project's page.
The goal of that check is to make sure that the server URL parsed from the analysis report is consistent with the server URL that is currently configured in Jenkins. Without the check, it could be possible to display wrong quality gate information after someone changes the server URL in the global configuration.

Is the message you are getting currently the following?


WARNING: Inconsistent server URL: 'http://my-sonar.company.com:9000' parsed, 'http://my-sonar.company.com' configured

If that's the case, could you go to the Jenkins global configuration page, and make sure that the SonarQube instance configuration has "http://my-sonar.company.com:9000" configured as host URL?
Don't rely on the hudson.plugins.sonar.SonarGlobalConfiguration.xml file - it is only used when Jenkins starts, and it's cached in memory.

mga...@cloudbees.com

unread,
Oct 31, 2016, 10:04:35 AM10/31/16
to SonarQube, aher...@cloudbees.com
Hi,

I confirm that:
  • the message is currently the following one:
WARNING: Inconsistent server URL: 'http://my-sonar.company.com:9000' parsed, 'http://my-sonar.company.com' configured
What could be the next steps?
Thanks

Duarte Meneses

unread,
Oct 31, 2016, 11:12:49 AM10/31/16
to SonarQube, aher...@cloudbees.com
Did you run again the Jenkins build after fixing the SonarQube's Server base URL? It needs to be done so that the new server base URL fetched during the SonarQube analysis is associated with the Jenkins build.
If you already did that, then I'm unable to reproduce the problem.

I'm puzzled about the inconsistency between the actual configured Server URL and the one logged in the warning. The configured ServerURL is loaded directly from the configuration, without any processing.

So what I would suggest is to change the SonarQube server URL configured in Jenkins ([Jenkins base url]/jenkins/configure) to something else to see if it changes the configured URL that is logged. It should be reflected in the logs immediately once you re-open the project page (no need to re-run an analysis in this case).

Mikael Gaunin

unread,
Nov 4, 2016, 3:35:23 AM11/4/16
to SonarQube, aher...@cloudbees.com
yes we ran builds after changing the URL.

I did a change of the URL in the config as suggested and do not see this reflected in the log:

Before changing the URL: 
"Nov 03, 2016 11:58:13 AM INFO hudson.plugins.sonar.client.SQProjectResolver resolve 
Invalid installation name: my-sonar.company.com:9000"
After changing: 
"Nov 03, 2016 12:03:12 PM INFO hudson.plugins.sonar.client.SQProjectResolver resolve 
Invalid installation name: my-sonar.company.com:9000"

And this is suddenly mentioned a lot in the logs, not sure if it is related: 
"Nov 03, 2016 12:00:11 PM WARNING hudson.plugins.sonar.client.SQProjectResolver resolve 
Error fetching project information 
net.sf.json.JSONException: Invalid JSON String 
.... more"
And =>
"Nov 03, 2016 12:04:25 PM WARNING hudson.ExpressionFactory2$JexlExpression evaluate 
Caught exception evaluating: descriptor.calcFillSettings(field,attrs) in /configure. Reason: java.lang.NullPointerException 
java.lang.NullPointerException 
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:213) 
.... more"

More recent messages in log: 
"Nov 03, 2016 1:54:12 PM INFO hudson.plugins.sonar.SonarBuildWrapper$SonarEnvironment buildEnvVars 
Injecting SonarQube environment variables using the configuration: my-sonar.company.com 
Nov 03, 2016 1:54:12 PM INFO hudson.plugins.sonar.SonarBuildWrapper$SonarEnvironment buildEnvVars 
Injecting SonarQube environment variables using the configuration: my-sonar.company.com"

And again more recently shows: 
Nov 03, 2016 2:08:24 PM WARNING hudson.plugins.sonar.client.SQProjectResolver checkServerUrl 
Inconsistent server URL: 'http://my-sonar.company.com:9000' parsed, 'http://my-sonar.company.com:9001' configured 
Nov 03, 2016 2:09:15 PM WARNING hudson.plugins.sonar.client.SQProjectResolver checkServerUrl 
Inconsistent server URL: 'http://my-sonar.company.com:9000' parsed, 'http://my-sonar.company.com:9001' configured 
Nov 03, 2016 2:10:12 PM INFO hudson.plugins.sonar.client.SQProjectResolver resolve 
Invalid installation name: my-sonar.company.com:9000 
Nov 03, 2016 2:10:12 PM WARNING hudson.plugins.sonar.client.SQProjectResolver checkServerUrl 
Inconsistent server URL: 'http://my-sonar.company.com:9000' parsed, 'http://my-sonar.company.com:9001' configured

What can I provide you with to help you to understand what happens?

janos....@sonarsource.com

unread,
Nov 7, 2016, 5:56:12 AM11/7/16
to SonarQube, aher...@cloudbees.com
Hi

I think there is some confusion here, let's try to clean that up.

When you say "the SonarQube instance configuration has "http://my-sonar.company.com:9000" configured as Server URL", I think you're talking about a configuration in Jenkins, specifically, in Manage Jenkins > Configure System > SonarQube servers section.
The other critical piece of the store is the configuration on SonarQube itself, not in Jenkins, but when you visit this URL: http://my-sonar.company.com:9000/settings
On this page of the SonarQube site, not Jenkins, there is a Server base URL field. This field should match the configuration in Jenkins, otherwise you get the warning about the inconsistent URLs.

From the email thread it's not clear if you have changed anything on SonarQube itself, it seems you only changed configuration on Jenkins-side, not on SonarQube-side. You need to do this second part, SonarQube-side.

I hope this clears things up, let us know how it goes.

Cheers,
Janos

janos....@sonarsource.com

unread,
Nov 7, 2016, 6:13:47 AM11/7/16
to SonarQube, aher...@cloudbees.com, janos....@sonarsource.com
One more thing, about this:


> Inconsistent server URL: 'http://my-sonar.company.com:9000' parsed, 'http://my-sonar.company.com:9001' configured

Here, http://my-sonar.company.com:9000 is the URL of the server used in the last analysis, and http://my-sonar.company.com:9001 is the URL in your Jenkins configuration.

To clear things up:

1. Take the URL of your SonarQube installation, let's call it http://yoursonar:9000
2. Go to your SonarQube settings, at http://yoursonar:9000/settings, and set the URL to http://yoursonar:9000
3. Go to your Jenkins settings (Manage Jenkins > Configure System > SonarQube servers section), and set the Server URL to http://yoursonar:9000
4. Go your Jenkins job and run an analysis

I hope this helps.

Cheers,
Janos

Mikael Gaunin

unread,
Nov 7, 2016, 8:54:34 AM11/7/16
to SonarQube, aher...@cloudbees.com, janos....@sonarsource.com
Yes, we set up the URL in SonarQube AND in Jenkins in the same way: 
Our SonarQube (Version 4.3) settings, at http://my-sonar.company.com:9000/settings/index, and set the Server base URL to http://my-sonar.company.com:9000 
---- 
Our CloudBees Jenkins Enterprise (Jenkins ver. 1.651.3.1 (CJE 16.06) - SonarQube Plugin v2.4.4) setting: In the Jenkins Configure System settings (http://my-jenkinscompany.com:8085/configure) we have set the Server URL to http://my-sonar.company.com:9000 
=== 
Still we currently get messages in the log about SonarQube installation which we cannot explain: 
"Nov 07, 2016 1:18:12 PM INFO hudson.plugins.sonar.client.SQProjectResolver resolve 
Invalid installation name: my-sonar.company.com:9000"

Janos Gyerik

unread,
Nov 7, 2016, 9:35:30 AM11/7/16
to Mikael Gaunin, SonarQube, aher...@cloudbees.com
"Invalid installation name: my-sonar.company.com:9000"

This is a completely different problem. This can happen when you have multiple SonarQube instance configuration in Jenkins, 



--
Janos GYERIK | SonarSource

Janos Gyerik

unread,
Nov 7, 2016, 9:38:35 AM11/7/16
to Mikael Gaunin, SonarQube, aher...@cloudbees.com
Sorry, sent accidentally with a keyboard shortcut ;-)

Do you still get "Inconsistent server URL" ? You didn't say, I hope not.

"Invalid installation name: my-sonar.company.com:9000"

This is a completely different problem. This can happen when you have multiple SonarQube instance configuration in Jenkins, let's say X and Y, and you have a Jenkins job configured to use X, and then you delete X. The job will continue to try to use X, which no longer exists. You can fix that by editing the job configuration. Select the correct SonarQube instance name. Note that when you only have one instance configured, the Jenkins UI will not let you select. In that case, simply click Save, and Jenkins will clear the bad setting, the job will revert to the one configured SonarQube instance.

Let me know how it goes.

Janos






Mikael Gaunin

unread,
Nov 8, 2016, 8:04:56 AM11/8/16
to SonarQube, mga...@cloudbees.com, aher...@cloudbees.com, janos....@sonarsource.com
Hi, the inconsistent server URL does not appear much anymore at all, although I saw a few appear when I was looking up Sonar jobs and re-saving them to fix the "Invalid installation name: my-sonar.company.com:9000" error you provided feedback about. 
Due to me changing the settings in the Jenkins configuration the invalid installation message is now appearing for jobs that used to have set the previous installation name. When I check the config of such a job it always shows the the current installation name ("my-sonar.company.com") and saving the job does not change that, but when I re-run a job after this the message does not appear in the log anymore for that particular job (upon revisit). 
I think we should close this ticket now, I don't see this getting completely resolved anytime soon and know which direction to look for the issues: 
When the installation name and/or server URL is changed for SonarQube installations in Jenkins config, this error can come up. 
Some time ago I used the Configuration Slicing plugin to change these settings for all related jobs, but unfortunately the plugin does not seem to recognize these jobs or parameters anymore because when I try the options, none are showing up?!

janos....@sonarsource.com

unread,
Nov 9, 2016, 5:01:05 AM11/9/16
to SonarQube, mga...@cloudbees.com, aher...@cloudbees.com, janos....@sonarsource.com
Hi,

The "invalid installation name" is a pure Jenkins configuration issue. I don't know a solution for that, other than choosing names you will not want to change later.

Cheers,
Janos

Mikael Gaunin

unread,
Dec 2, 2016, 5:19:03 AM12/2/16
to SonarQube, mga...@cloudbees.com, aher...@cloudbees.com, janos....@sonarsource.com
Ok, I understand your point.
I have a last comment to do on this thread. It seems that the Configuration Slicing plugin is not able to gather the information for SonarQube (Build Step) - SonarQube Server Slicer
when it works well for SonarQube (Post Build) - SonarQube Server Slicer.
I guess there is an issue somewhere in the way you manage the build step (certainly different from the post-build action).

It was just to make you aware of this issue.

Mikael

Julien HENRY

unread,
Dec 5, 2016, 3:40:57 AM12/5/16
to SonarQube, mga...@cloudbees.com, aher...@cloudbees.com, janos....@sonarsource.com
Reply all
Reply to author
Forward
0 new messages