SonarQube连接MySQL时无法启动

时间:2017-01-05 00:42:59

标签: mysql sonarqube sonarqube-web

如果我没有将MySql数据库连接到Sonar,则Web UI可以在localhost:9000上加载没有问题。如果我更新MySQL的配置文件,Web将无法启动,但我无法从日志中看到提示。

sonar.properties:

--> 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

日志:

import { Component, Input, ElementRef, AfterViewInit } from '@angular/core';

@Component({
selector: 'read-more',
template: `
    <div [style.height]="isCollapsed ? maxHeight+'px' : autoHeight">
        <ng-content></ng-content>
    </div> 

    <span *ngIf="isCollapsable" class="btn-link cpointer" (click)="isCollapsed =! isCollapsed">Read {{isCollapsed? 'more':'less'}} ...</span>

    `,
styles: [` div { overflow-y: hidden; 
          -moz-transition: height .5s;
          -ms-transition: height .5s;
          -o-transition: height .5s;
          -webkit-transition: height .5s;
          transition: height .5s; ease;}
         .cpointer {cursor:pointer; }
        `]
})
export class ReadMoreComponent implements AfterViewInit {

@Input()
maxHeight: number = 40; //two lines

////set these to false to get the height of the expended container 
isCollapsed: boolean = false;
isCollapsable: boolean = false;
autoHeight: string= "auto";

constructor(private elementRef: ElementRef) {}

ngAfterViewInit() {
    // Inportant !!
    // wait a tick to avoid one-time devMode
    // unidirectional-data-flow-violation error
    setTimeout(_ => {
            let currentHeight = this.elementRef.nativeElement.getElementsByTagName('div')[0].offsetHeight;

            this.autoHeight = currentHeight + "px";
            //collapsable only if the contents make container exceed the max height
            if (currentHeight >= this.maxHeight) {
                this.isCollapsed = true;
                this.isCollapsable = true;
            }
        }
    );
}

}

2 个答案:

答案 0 :(得分:3)

我在MySQL数据库中连接错误的模式。我已将用户设置为使用sonarqube架构。

Incorect:

JDBC:MySQL的://本地主机:3306 /的声纳了useUnicode =真安培;的characterEncoding = UTF8&安培; rewriteBatchedStatements =真安培; useConfigs = maxPerformance&安培; useSSL =假

正确:

sonar.jdbc.url = JDBC:MySQL的://本地主机:3306 /的 sonarqube 了useUnicode =真安培;的characterEncoding = UTF8&安培; rewriteBatchedStatements =真安培; useConfigs = maxPerformance&安培; useSSL =假

答案 1 :(得分:1)

我没有启动sonarqube-6.7有类似的问题。在后台我使用10.1.25-MariaDB-1。它没有启动的原因是在我的/opt/sonar/logs/web.log文件中。 web.log中有一条消息:

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

据我所知,这是MariaDb与sonarqube-6.7不兼容,尽管Mariadb似乎与MySql兼容。 所以我的解决方案是简单地切换到另一个db postgreSQL。之后,sonarqube成功地开始了。