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

2019-07-20 15:34发布

问题:

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

回答1:

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


回答2:

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$



回答3:

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.