Sonar数据库访问被拒绝

时间:2015-02-18 14:19:47

标签: sonarqube

我遇到了“拒绝访问”的问题。连接到Sonar数据库时出错。跟踪下方:

[workspace]        $ /var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/Sonar/bin/sonar-runner -Dsonar.jdbc.driver=com.mysql.jdbc.Driver -Dsonar.jdbc.url=jdbc:mysql://tridev002.xxxxx.net:3306/sonar ******** ******** -Dsonar.host.url=http://tridev002.xxxx.net:9000/ ******** ******** "-Dsonar.projectBaseDir=/var/lib/jenkins/jobs/Test Sonar/workspace"
SonarQube Runner 2.4
Java 1.7.0_72 Oracle Corporation (64-bit)
Linux 3.2.0-4-amd64 amd64
INFO: Runner configuration  file: /var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/Sonar/conf/sonar-runner.properties
INFO: Project configuration file: NONE
INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Work directory: /var/lib/jenkins/jobs/Test Sonar/workspace/.sonar
INFO: SonarQube Server 4.5.1
13:44:54.656 INFO  - Load global referentials...
13:44:54.825 INFO  - Load global referentials done: 173 ms
13:44:54.833 INFO  - User cache: /var/lib/jenkins/.sonar/cache
13:44:54.841 INFO  - Install plugins
13:44:54.920 INFO  - Install JDBC driver
13:44:54.926 INFO  - Create JDBC datasource for jdbc:mysql://tridev002.xxxxx.net:3306/sonar
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 1.494s
Final Memory: 8M/241M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: Fail to connect to database
ERROR: Caused by: Cannot create PoolableConnectionFactory (Access denied for  user 'jenkins-sonar'@'tridev002.xxxxx.net' (using password: YES))
ERROR: Caused by: Access denied for user 'jenkins-  sonar'@'tridev002.xxxxx.net' (using password: YES)
ERROR: 
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Invoke Standalone Sonar Analysis' marked build as failure 

在Jenkins配置中,正确设置了数据库URL,数据库登录和数据库密码。使用此URL和凭据,可以通过mysql命令行客户端登录,我们可以查看声纳数据库表。 我们还检查了数据库用户的权限,并正确设置了这些权限。 我们检查了sonar.properties文件,所有内容都被注释掉了。

如果我们将sonar.jdbc.username和sonar.jdbc.password添加到项目属性,则与数据库的连接是成功的。但密码是纯文本,这是不可取的。

有谁知道为什么不使用系统配置的凭据?什么是解决方案?这是SonarQube中的错误吗?

0 个答案:

没有答案