We are getting the following exception in Stash when reviewing a pull request. This exception began after upgrading SonarQube to 5.3.
2016-01-28 20:00:35,915 ERROR [http-nio-8080-exec-1018] michael_giroux @17KNLFXx1200x12511000x6 msajgq 172.22.8.70 "GET /rest/sonar4stash/1.0/sonarissues HTTP/1.1" c.a.p.r.c.e.j.ThrowableExceptionMapper Uncaught exception thrown by REST service: JSONObject["pages"] not found.
org.json.JSONException: JSONObject["pages"] not found.
at org.json.JSONObject.get(JSONObject.java:422) ~[json-20070829-1.jar:na]
at org.json.JSONObject.getInt(JSONObject.java:483) ~[json-20070829-1.jar:na]
at ch.mibex.stash.sonar4stash.sonar.DefaultSonarClient.ch$mibex$stash$sonar4stash$sonar$DefaultSonarClient$$toPagingInfo(DefaultSonarClient.scala:134) ~[plugin_1120250090807200834_sonar4stash-1.3.3_1454032655000.jar:n
At the time of the stack trace, we had 1.3.3. installed. Misread the comparability matrix.
However, we had tried 1.5.0, and that was giving us issues as well.
Background -- we are building in Jeniins and are using a post build step described in Atlassian wiki. Does this need to be refined for the current configuration (SonarQube 5.3 + sonar4stash 1.5.0)
# A post-build script to parse the GIT_BRANCH variable into a
# simple branch name suitable for use as a sonar project name.
# Ref: sonar3stash plugin
echo "GIT_BRANCH: ($GIT_BRANCH)"
echo SONAR_BRANCH=$(printf '%s' $GIT_BRANCH | cut -d'/' -f 2- | sed s/[^0-9a-zA-Z:_.\-]/'_'/g) | tee sonar-branch
With version 1.5.0 installed, I'm seeing this:
2016-01-29 07:56:57,690 WARN [http-nio-8080-exec-1188] michael_giroux @17KNLFXx476x12533224x9 11cu9ts 172.22.8.70 "GET /rest/sonar4stash/1.0/statistics HTTP/1.1" c.m.s.s.s.i.IssuesInPullRequestCollector SONAR:choicehotels.devops:test does not match the determined one from the build files choicehotels:test
and a few others like this:
2016-01-29 07:56:59,485 WARN [http-nio-8080-exec-1195] leon_mattie @17KNLFXx476x12533225x7 1jh80nz 172.22.72.131 "GET /rest/sonar4stash/1.0/statistics HTTP/1.1" c.m.s.s.s.s.SonarStatisticsResource SONAR: 404 failed to retrieve statistics: Not Found
2016-01-29 07:57:01,762 WARN [http-nio-8080-exec-1188] leon_mattie @17KNLFXx477x12533244x7 1jh80nz 172.22.72.131 "GET /rest/sonar4stash/1.0/statistics HTTP/1.1" c.m.s.s.s.s.SonarStatisticsResource SONAR: 404 failed to retriev
Your Jenkins configuration is fine and should work with SonarQube 5.3 as well.
The error message you get means that the SonarQube project key you defined in the repository settings of the plug-in does not match the one from your build files. Has that changed lately? Could you please try to change your project key in the repository settings to "choicehotels:test"?
What kind of build system are you using to trigger SonarQube (Gradle, Maven, SonarRunner)? If changing the project key does not help, you could try to switch to the "compatibility mode" in the plug-in settings which behaves like version 1.3.3.
Thanks for the pointers. I now have a pull request with stats in the overview and sonar issues flagged in the diff view.
It looks like the update to version 1.5.0 was the root cause. Other issues came about due to a source change I made trying to dig into this.
FWIW, I did not find anything on the internet describing the error I got from the 1.3.3.version:
ThrowableExceptionMapper Uncaught exception thrown by REST service: JSONObject["pages"] not found.
I might have solved this myself if the plugin logged a warning that a version conflict may exist. Just thinking out loud
Again, thanks for the help.
Glad to here that it worked for you!
You're absolutely right. We will log a warning in this case for the next version of the plug-in. I have also added it to our knowledge base (see https://mibexsoftware.atlassian.net/wiki/pages/viewpage.action?pageId=29917196).
As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs