尽管分析成功,为什么SonarQube没有显示结果?

时间:2015-08-03 06:57:59

标签: sonarqube sonar-runner

我使用sonar-runner分析我的项目并且分析成功:

14:30:34.813 INFO  - Analysis reports sent to server in 160ms
14:30:34.813 INFO  - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/AMLServerProj
14:30:34.813 INFO  - Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report.
14:30:34.814 DEBUG - Post-jobs : 
14:30:34.815 DEBUG - Release semaphore on project : org.sonar.api.resources.Project@3335ebfc[id=1,key=AMLServerProj,qualifier=TRK], with key batch-AMLServerProj
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
Total time: 53.958s
Final Memory: 26M/788M
INFO: ------------------------------------------------------------------------

但是当我导航到http://localhost:9000/dashboard/index/AMLServerProj时,我收到此错误消息:

No analysis has been performed since creation. The only available section is the configuration.

这是我的错误日志:

2015.08.03 20:47:01 INFO  web[o.s.s.c.ComputationService] Analysis of project AMLServerProj (report 2) (done) | time=7880ms
2015.08.03 20:47:01 ERROR web[o.s.s.c.ComputationThread] Failed to process analysis report 2 of project AMLServerProj
org.apache.ibatis.exceptions.PersistenceException: 
### Error committing transaction.  Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.core.issue.db.IssueMapper.insert (batch index #2) failed. 1 prior sub executor(s) completed successfully, but will be rolled back. Cause: java.sql.BatchUpdateException: Incorrect string value: '\xF3\xA3\xBA\xB1\xEF\xBF...' for column 'message' at row 107
### Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.core.issue.db.IssueMapper.insert (batch index #2) failed. 1 prior sub executor(s) completed successfully, but will be rolled back. Cause: java.sql.BatchUpdateException: Incorrect string value: '\xF3\xA3\xBA\xB1\xEF\xBF...' for column 'message' at row 107
    at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26) ~[mybatis-3.2.7.jar:3.2.7]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.commit(DefaultSqlSession.java:177) ~[mybatis-3.2.7.jar:3.2.7]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.commit(DefaultSqlSession.java:169) ~[mybatis-3.2.7.jar:3.2.7]
    at org.sonar.core.persistence.DbSession.commit(DbSession.java:61) ~[sonar-core-5.1.1.jar:na]
    at org.sonar.core.persistence.BatchSession.commit(BatchSession.java:177) ~[sonar-core-5.1.1.jar:na]
    at org.sonar.core.persistence.BatchSession.increment(BatchSession.java:214) ~[sonar-core-5.1.1.jar:na]
    at org.sonar.core.persistence.BatchSession.insert(BatchSession.java:134) ~[sonar-core-5.1.1.jar:na]
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:51) ~[mybatis-3.2.7.jar:3.2.7]
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52) ~[mybatis-3.2.7.jar:3.2.7]
    at com.sun.proxy.$Proxy91.insert(Unknown Source) ~[na:na]
    at org.sonar.server.computation.step.PersistIssuesStep.execute(PersistIssuesStep.java:79) ~[sonar-server-5.1.1.jar:na]
    at org.sonar.server.computation.ComputationService.process(ComputationService.java:89) ~[sonar-server-5.1.1.jar:na]
    at org.sonar.server.computation.ComputationContainer.execute(ComputationContainer.java:47) ~[sonar-server-5.1.1.jar:na]
    at org.sonar.server.computation.ComputationThread.run(ComputationThread.java:58) ~[sonar-server-5.1.1.jar:na]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_67]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_67]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_67]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) [na:1.7.0_67]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_67]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_67]
    at java.lang.Thread.run(Thread.java:745) [na:1.7.0_67]
Caused by: org.apache.ibatis.executor.BatchExecutorException: org.sonar.core.issue.db.IssueMapper.insert (batch index #2) failed. 1 prior sub executor(s) completed successfully, but will be rolled back. Cause: java.sql.BatchUpdateException: Incorrect string value: '\xF3\xA3\xBA\xB1\xEF\xBF...' for column 'message' at row 107
    at org.apache.ibatis.executor.BatchExecutor.doFlushStatements(BatchExecutor.java:127) ~[mybatis-3.2.7.jar:3.2.7]
    at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:114) ~[mybatis-3.2.7.jar:3.2.7]
    at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:109) ~[mybatis-3.2.7.jar:3.2.7]
    at org.apache.ibatis.executor.BaseExecutor.commit(BaseExecutor.java:201) ~[mybatis-3.2.7.jar:3.2.7]
    at org.apache.ibatis.executor.CachingExecutor.commit(CachingExecutor.java:104) ~[mybatis-3.2.7.jar:3.2.7]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.commit(DefaultSqlSession.java:174) ~[mybatis-3.2.7.jar:3.2.7]
    ... 19 common frames omitted
Caused by: java.sql.BatchUpdateException: Incorrect string value: '\xF3\xA3\xBA\xB1\xEF\xBF...' for column 'message' at row 107
    at com.mysql.jdbc.PreparedStatement.executeBatchedInserts(PreparedStatement.java:1603) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1268) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297) ~[commons-dbcp-1.4.jar:1.4]
    at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297) ~[commons-dbcp-1.4.jar:1.4]
    at org.apache.ibatis.executor.BatchExecutor.doFlushStatements(BatchExecutor.java:103) ~[mybatis-3.2.7.jar:3.2.7]
    ... 24 common frames omitted
Caused by: java.sql.SQLException: Incorrect string value: '\xF3\xA3\xBA\xB1\xEF\xBF...' for column 'message' at row 107
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3887) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3823) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2530) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1907) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2141) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2077) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2062) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    at com.mysql.jdbc.PreparedStatement.executeBatchedInserts(PreparedStatement.java:1564) ~[mysql-connector-java-5.1.34.jar:5.1.34]
    ... 28 common frames omitted

这是我的sonar-project.properties

sonar.projectKey=AMLServerProj
sonar.projectName=AMLServerProj5.1
sonar.projectVersion=1.0
sonar.sources=src
sonar.language=java
sonar.sourceEncoding=UTF-8

2 个答案:

答案 0 :(得分:5)

可以有两种解释:

  • 您浏览Web应用程序的速度太快,服务器没有时间处理您的分析。如日志所示:"Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report."

  • 如果您认为已经等了太久,可能是服务器端的分析处理出错了。在这种情况下,有两种方法可以检查:

    • 在“设置>系统>分析报告>过去报告”管理页面中,您应该能够看到处理失败

    • 在服务器日志中,您应该有一条错误消息,提供有关失败的更多详细信息

答案 1 :(得分:2)

对于那些无法找到任何失败的后台任务或错误日志的人,并想知道为什么Sonar在测试成功时不会显示结果 - 只需检查您的sonar.analysis.mode是什么。它应该是publish,因为previewissues不会将结果发送给Sonar。

在我们的案例中,我们创建了集成(结果在Sonar中可见),然后配置与Gitlab plugin的集成,这迫使我们将分析模式更改为preview。然后,即使测试成功,我们的结果在声纳中也看不到 - 我没有意识到这种联系,因为这是我第一次使用Sonar而且......已经晚了; - )

现在我们运行Sonar分析2次,一次用于Sonar服务器结果,一次用于Gitlab autoreview。