无法在jenkins上创建PoolableConnectionFactory

时间:2015-10-19 13:25:03

标签: mysql jenkins sonarqube5.1

我正在使用Sonarqube和MySql。我有Jenkins,我想将Sonar runner与TC集成,主要用于不同的项目(Java,PHP)。我做了以下事情:

  1. 在windows plateform中下载声纳zip(最新版本)。
  2. StartSonar.bat
  3. 我在远程VM中的CentOS中有一个MySQL:
    • 我使用Cygwin ssh连接到远程MySQL:
    • 然后我创建了一个架构,如下所示:
  4. MySQL的:

    CREATE DATABASE sonar CHARACTER SET UTF8;
    CREATE USER 'sonar'@'*' IDENTIFIED BY 'sonar';
    GRANT ALL ON sonar.* TO 'sonar'@'*';
    FLUSH PRIVILEGES;
    
    1. 然后我使用:sudo systemctl stop firewalld
    2. 禁用了VM防火墙
    3. 当我使用StartSonar.bat启动声纳时,出现以下错误:
    4. 堆栈跟踪:

      Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'sonar'@'10.1.162.61' (using password: YES))
          at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549) ~[commons-dbcp-1.4.jar:1.4]
          at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388) ~[commons-dbcp-1.4.jar:1.4]
          at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) ~[commons-dbcp-1.4.jar:1.4]
          at org.sonar.core.persistence.DefaultDatabase.checkConnection(DefaultDatabase.java:115) ~[sonar-core-5.1.2.jar:na]
          ... 28 common frames omitted
      
      Caused by: java.sql.SQLException: Access denied for user 'sonar'@'10.1.162.61' (using password: YES)
          at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996) ~[mysql-connector-java-5.1.34.jar:5.1.34]
      

      我在这里想念的是什么?

1 个答案:

答案 0 :(得分:0)

解决方案是在conf文件夹中的sonar.properties中启用声纳凭证,如下所示:

# User credentials.
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar

#----- MySQL 5.x
# Only InnoDB storage engine is supported (not myISAM).
# Only the bundled driver is supported.
sonar.jdbc.url=jdbc:mysql://10.1.163.103:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance