SonarQube Not Starting when connecting to MySQL

8.1k views Asked by At

If I don't connect the MySql database to Sonar, the web UI can load no problem on localhost:9000. If I update the configuration file for MySQL, the web won't start, but I can't see a hint from the log.

sonar.properties:

# User credentials.
# Permissions to create tables, indices and triggers must be granted to JDBC user.
# The schema must be created first.
sonar.jdbc.username=sonarqube
sonar.jdbc.password=password
#----- Embedded Database (default)
# H2 embedded database server listening port, defaults to 9092
# sonar.embeddedDatabase.port=9092
#----- MySQL 5.6 or greater
# Only InnoDB storage engine is supported (not myISAM).
# Only the bundled driver is supported. It can not be changed.
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false

Log:

--> Wrapper Started as Console
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

2017.01.04 19:38:08 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory C:\Program Files (x86)\sonarqube-6.2\temp
2017.01.04 19:38:08 INFO  app[][o.s.p.m.JavaProcessLauncher] Launch process[es]: C:\Program Files\Java\jre1.8.0_101\bin\java -Djava.awt.headless=true -Xmx1G -Xms256m -Xss256k -Djna.nosys=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=C:\Program Files (x86)\sonarqube-6.2\temp -javaagent:C:\Program Files\Java\jre1.8.0_101\lib\management-agent.jar -cp ./lib/common/*;./lib/search/* org.sonar.search.SearchServer C:\Program Files (x86)\sonarqube-6.2\temp\sq-process2983841696812955615properties
2017.01.04 19:38:21 INFO  app[][o.s.p.m.Monitor] Process[es] is up
2017.01.04 19:38:21 INFO  app[][o.s.p.m.JavaProcessLauncher] Launch process[web]: C:\Program Files\Java\jre1.8.0_101\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false -Djruby.compile.invokedynamic=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=C:\Program Files (x86)\sonarqube-6.2\temp -javaagent:C:\Program Files\Java\jre1.8.0_101\lib\management-agent.jar -cp ./lib/common/*;./lib/server/*;C:\Program Files (x86)\sonarqube-6.2\lib\jdbc\mysql\mysql-connector-java-5.1.39.jar org.sonar.server.app.WebServer C:\Program Files (x86)\sonarqube-6.2\temp\sq-process7994513818856510085properties
2017.01.04 19:38:25 INFO  app[][o.s.p.m.Monitor] Process[es] is stopping
2017.01.04 19:38:25 ERROR app[][o.s.p.m.Monitor] Process[web] failed to start
2017.01.04 19:38:26 INFO  app[][o.s.p.m.Monitor] Process[es] is stopped
<-- Wrapper Stopped
2

There are 2 answers

1
Mark D On

I was connecting to the wrong schema in the MySQL database. I have set up my user to use the sonarqube schema.

Incorect:

jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false

Correct:

sonar.jdbc.url=jdbc:mysql://localhost:3306/sonarqube?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false

0
Юра Арабчук On

I had similar problem with not starting sonarqube-6.7. In background I used 10.1.25-MariaDB-1. The reason why it did not started was in my /opt/sonar/logs/web.log file. There was a message in web.log:

    Web server startup failed: Unsupported mysql version: 5.5. Minimal supported version is 5.6. 

As i understood this is that MariaDb is not compatible with sonarqube-6.7 although Mariadb seems to be compatible with MySql. So my solution was to simply switch to another db postgreSQL. And after that sonarqube started successfuly.