Odd problem with Rules, cannot view them in page or request via API (throws Exception on ComponentContainer.java:71)

39 views
Skip to first unread message

zka...@gmail.com

unread,
Dec 18, 2017, 8:44:53 PM12/18/17
to SonarQube
Hello,
I have two instances of SonarQube on two closed networks, let's call them A and B.  The Internet is also not visible to either network.

Until Friday, both A and B were running SonarQube 6.5 with SonarJava 4.12.0.11033.  Friday I took instance A through the upgrade to SonarQube 6.7 and SonarJava 4.15.0.12310.  After the /setup step ran to upgrade the database, the website no longer worked.  I was confused about the update (someone else used to do these for our group but is no longer around, so I haven't done it before), and so I must have screwed something up along the way (my guess is when I got confused about elasticsearch and tried to run it on its own), but regardless something was wrong with my mysql database and elasticsearch kept failing to index it.  Luckily, I make backups every day at 4am, so I had a backup from before I did the upgrade.  So I ran backup that into the database, and pointed the startup script at my old 6.5 folder, and everything started up (seemingly normally).  I even had SonarJava 4.15 still in there since the upgrade instructions said to do that part first.

Next, just to be sure, I ran my ant build script that kicks off the analysis.  When it got to the line that calls for <sonar:sonar xmlns:sonar="antling:org.sonar.ant" />, it failed when it called for [sonar:sonar] Load active rules.  I figured something is maybe wrong with rules that maybe no longer exist in SonarJava 4.15.  In the web page, I opened the Rules page, but nothing loaded.  Instead, it says in the center "No Coding Rules" and there is a circular swirl under it that never stops swirling.  I also got a red popup error that says "An error has occurred.  Please contact your administrator" then goes away after a few seconds. I checked the Quality Profiles page, and there it has a bunch of profiles listed, with my quality profile (that we have from taking Sonar Way rules a couple of years ago and tweaking a copy of them) listing that it has 2 deprecated rules.  When I clicked on that, it took me to the Rules screen which then gave me that same error of "An error has occurred.  Please contact your administrator" with No Coding Rules listed.    I backed up my quality profile and then deleted it, making Sonar Way the default, just to see if that does anything.  I still could not go to any rules.  I then re-ran my ant script to see if that makes any difference, and got the same error.  Here is an abbreviated stack trace (since those machines don't see the Internet, it's hard to get an exact copy over):

[sonar:sonar] Load active rules

BUILD FAILED
Build.xml:213: java.lang.
IllegalStateException: Unable to load component class org.sonar.scanner.report.ActiveRulesPublisher
At org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:71)
....
Caused by: java.lang.IllegalStateException: Unable to load component interface org.sonar.api.batch.rule.activeRules
At org.sonar.core.platform.ComponentContainer$ ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:71)
....
Caused by: org.sonarqube.ws.client.HttpException: Error 500 on http://sonarqube.lab:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&Activation=true&qprofile=AWBrsOWqAakFfx0sIEV5&p=1&ps=500 : {"errors":[{"msg":"An error has occurred.  Please contact your administrator"}]}
At org.sonarqube.ws.client.BaseResponse.failIfNotSuccessful(BaseResponse.java:36)
...
So pretty much the same error.  For some reason, the rule retrieval is screwed up.

Just to see what this looks like on instance B, where I had performed no upgrades at all (all had been done by that previous person), and B was working fine for it's equivalent ant build script, however, B also failed to load the Rules page!  No error however, just a "No Coding Rules" and the swirly.

So something is wrong on both A and B that prevents me from seeing the rules, but at least B is able to do the build while A is not.

Any ideas as to what might be going on?

G. Ann Campbell

unread,
Jan 2, 2018, 12:03:15 PM1/2/18
to SonarQube
Hi,

It sounds like there was some sort of error during the upgrade process. Rather than subbing in old ElasticSearch indices you ideally would have asked for help at that point. If you had, we'd have told you to check the log files in $SONARQUBE_HOME/logs. I'd start with es.log, which is where ElasticSearch stuff is written. Note that 6.7 uses a version of ElasticSearch which refuses to run as root.

To untangle your current state, I'd use your backups to regress to the pre-upgrade state, re-run the upgrade and check the logs.


Ann
Reply all
Reply to author
Forward
0 new messages