When run “sonar-runer” throw exception :“Caused by

2019-07-20 15:48发布

I need help

First , it throw exception

cannot load class 'com.mysql.xxx.JDBC'",so I copy the sonarqube-4.0/extensions/jdbc-driver/mysql/mysql-connector-java-5.1.26.jar to the /usr/lib/jvm/java-7-sun/jre/lib/ext/

Then I run sonar-runner again, it throws this exception:

Unknown database status: FRESH_INSTALL

My heart is broken , plz help me

3条回答
贼婆χ
2楼-- · 2019-07-20 15:52

I saw this error when the database is empty (no tables are created). Usually tables are created during first start of sonar.

Can you reach sonar by web interface?

Make sure that settings in your conf/sonar.properties file in Sonar directory are correct, these lines should be uncommented.

sonar.jdbc.url:                            jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true
sonar.jdbc.username:                       mysqlusername
sonar.jdbc.password:                       mysqlpassword

Then check if your conf/sonar-runner.properties file in sonar-runer directory has the same settings.

#----- MySQL
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8

#----- Global database settings
sonar.jdbc.username=mysqlusername
sonar.jdbc.password=mysqlpassword

Also make sure that the line for default embeded database is commented.

#sonar.jdbc.url:                            jdbc:h2:tcp://localhost:9092/sonar
查看更多
何必那么认真
3楼-- · 2019-07-20 15:57

I just encountered the same problem, and I solved it by restarting sonar server after creating proper user and database in mysql.
In fact, sonar server will fill the empty mysql database with many tables after restarting, and that removed the "FRESH_INSTALL" problem.

查看更多
兄弟一词,经得起流年.
4楼-- · 2019-07-20 16:11

Sonar stopped supporting the property "sonar.jdbc.schema" from 4.2 version. Please refer link http://jira.codehaus.org/browse/SONAR-5000. To fix the issue on PostgreSQL based sonar deployment, execute the following SQL command on the database:

ALTER USER $dbUser$ SET search_path to $soanrQubeSchema$

查看更多
登录 后发表回答