本文介绍了声纳无法连接到MySQL总是尝试jdbc:h2:tcp://localhost/sonar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天早上,我已经下载了Sonar最新版本. Maven 3.2.5,MySQL.声纳设置正确,并且我的网站在9000上运行良好,并且所有表均在mySql中正确创建.我已经使用以下内容更新了.m2/settings.xml

This morning I have downloaded Sonar latest version. maven 3.2.5, mysql.Sonar setup went correctly and I have the web site at 9000 working fine and all tables correctly created in mySql.I have updated my .m2/settings.xml with the following

<profiles>
  <profile>
    <id>sonar</id>
    <properties>
      <sonar.jdbc.url>jdbc:mysql://localhost:3306/sonar?useUnicode=true&amp;characterEncoding=utf8&amp;rewriteBatchedStatements=true</sonar.jdbc.url>
      <sonar.jdbc.username>myuser</sonar.jdbc.username>
      <sonar.jdbc.password>mypassword</sonar.jdbc.password>
       <sonar.host.url>http://localhost:9000</sonar.host.url>
    </properties>
  </profile>
</profiles>

我尝试了 mvn sonar:sonar ,我总是得到

INFO: Work directory: /home/salam/git/spring-petclinic/target/sonar
INFO: SonarQube Server 5.1
[INFO] [00:11:25.410] Load global repositories
[INFO] [00:11:26.307] Load global repositories (done) | time=905ms
[INFO] [00:11:26.317] Server id: 20150406220059
[INFO] [00:11:26.326] User cache: /home/salam/.sonar/cache
[INFO] [00:11:26.360] Install plugins
[INFO] [00:11:26.539] Install JDBC driver
[INFO] [00:11:26.554] Create JDBC datasource for jdbc:h2:tcp://localhost/sonar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

我什至用

sonar.jdbc.driverClassName=com.mysql.jdbc.Driver
sonar.sourceEncoding=UTF-8
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&amp;characterEncoding=utf8
sonar.jdbc.username=myuser
sonar.jdbc.password=mypassword 

没有办法,总是出现相同的错误,声纳无法通过

No way, always getting the same error and sonar can not go through

我在这里访问了几个线程 Sonar无法连接到数据库我知道我所做的应该会使这个项目正常进行,但事实并非如此

I visited a couple of threads here Sonar fails to connect to databaseI understand that what I have doen should make this project works fine but this is not the case

感谢您的帮助

推荐答案

我解决了.我需要在settings.xml中添加以下内容

I solved it. I needed to add the following in the settings.xml

<activation>
    <activeByDefault>true</activeByDefault>
</activation>

这篇关于声纳无法连接到MySQL总是尝试jdbc:h2:tcp://localhost/sonar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-17 01:18