user1720124
user1720124

Reputation: 117

Sonar throwing error BadDatabaseVersion

I have installed sonar and mysql database on server A and on server B. I'm trying to run sonar analysis using sonar-runner but every time I get the following error:

Caused by: java.lang.RuntimeException: wrapper
    at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.monitorAndThrowReflectionLifecycleException(ReflectionLifecycleStrategy.java:130)
    ... 22 more
Caused by: org.sonar.core.persistence.BadDatabaseVersion: The current batch process and the configured remote server do not share the same DB configuration.
    - Batch side: jdbc:mysql://xx.xx.xx.xx:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true (sonar / *****)
    - Server side: check the configuration at http://xx.xx.xx.xx:9000/system

Server B is accessing DB from server A. I have checked all configurations from batch and server side everything seems to be ok.

I also googled and found the following link, but I cannot understand what to do for resolving this issue.

Any pointers?

Upvotes: 3

Views: 3492

Answers (2)

pards
pards

Reputation: 1166

This error can also happen if you have 2 Sonar instances pointing at the same database. You can only have one Sonar instance per database.

Sonar updates a row in the properties table where prop_key = 'sonar.core.id' every time it starts up, and then compares the cached value against the one in the database whenever an analysis is executed. If the two don't match then you get the error.

To fix it, shut down both instances then only restart the instance you want to keep. Sonar will reset the sonar.core.id value and things should work again.

You can get the server's cached id via REST: http://server:port/sonar/api/server

It has to match the one in the database for Sonar to work. select * from properties where prop_key = 'sonar.core.id'

Upvotes: 6

Mark O'Connor
Mark O'Connor

Reputation: 77961

Are you certain the database settings used by the Sonar server:

Match the database credentials used by your build?

The error message suggests they don't. The JIRA issue SONAR-3685 was closed with a "Not A Bug" resolution code.

Upvotes: 0

Related Questions