问题
I use sonar-runner to analyse my project and the analysis succeeds:
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: ------------------------------------------------------------------------
But when I navigate to http://localhost:9000/dashboard/index/AMLServerProj I get this error message:
No analysis has been performed since creation. The only available section is the configuration.
This is my error log:
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
This is my sonar-project.properties
:
sonar.projectKey=AMLServerProj
sonar.projectName=AMLServerProj5.1
sonar.projectVersion=1.0
sonar.sources=src
sonar.language=java
sonar.sourceEncoding=UTF-8
回答1:
There can be 2 explanations for this:
You browsed the Web application too rapidly, the server did not have the time to process your analysis. As the log says:
"Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report."
If you think that you've waited already for too long, maybe the processing of your analysis on server-side went wrong. In this case, there are 2 ways to check this:
In the "Settings > System > Analysis Reports > Past Reports" administration page, you should be able to see that the processing failed
In the server logs, you should have a error message that gives more details about the failure
回答2:
For those who can't find any failed background tasks or error logs and wonders why Sonar does not show results if test was successful - just check what is your sonar.analysis.mode
. It should be publish
, because preview
and issues
does not send results to Sonar.
In our case we created integration (results were visible in Sonar), then configured integration with Gitlab plugin which forced us to change analysis mode to preview
. Then our results were not visible in Sonar even if test was successful - I didn't realize that connection because it was first time when I used Sonar and.. it was late ;-)
Now we run Sonar analysis 2 times, one for Sonar server results, one for Gitlab autoreview.
来源:https://stackoverflow.com/questions/31781158/why-does-sonarqube-not-show-results-although-the-analysis-succeeded